Java – Abstract classes & methods

Java – Abstract classes & methods

Abstract class is a class where its implementation is incomplete or non-existent. Abstract class cannot be instantiated but can be extended. A subclass that implements an abstract class can be instantiated. Abstract class is similar to interface but also have some differences. Both cannot be instantiated and both can contain methods without implementation. The differences are: a class can extend only one class but can implement many interfaces separating them with “,” An abstract class can define fields that are not static nor final. An interface all fields must be…

Java – Abstract classes & methods Read More

Java – Classes and methods

Java – Classes and methods

Method is a group of statements to which we give a name so we can execute them. When we call a method, the program first executes the statements in the method and then it continues with the code below the method call. syntax: modifier returnType methodName(Parameters){ statement(s) } modifier: (access modifiers) public | private | protected and (non-access modifiers) static | final | abstract returnType: If the method returns a value then you should specify the type here. Use return as the last statement in the method. If not then…

Java – Classes and methods Read More

Java – Classes

Java – Classes

Class is a blueprint of an object, it describes the object. An object is an instance of a class. Java is Object-Oriented Programming (OOP) language, that means that supports objects and programs written in Java perform most of their actions/behaviour with objects. syntax: public class ClassName{ variables/state methods/behavior} Create a new class with IntelliJ IDEA Right-click src directory, New and then Java Class. You will see the following pop-up window. Specify the Name and click Ok. The Class file name should be the same as the class name and it…

Java – Classes Read More

CSS – Classes, IDs, Pseudo-classes and more…

CSS – Classes, IDs, Pseudo-classes and more…

Class You can create a name for a specific group of elements and then you can apply a style. Create a class Create a style for this class .myClass{ background-color: aquamarine;} id You can create a name for a specific element and then you can apply a style. <p id=”name”> I am KRONOS</p> #name{ color: blue; font-size: 2em;} Pseudo-classes Pseudo-classes permit formatting based on element’s state and not on information that lies on the document tree(tags). They should always be applied to an existing selector and you use: and then…

CSS – Classes, IDs, Pseudo-classes and more… Read More

Kotlin – Data Classes

Kotlin – Data Classes

If you want to create that it’s only purpose is to hold data, then Data class is for you. You can declare a data class this way: Data classes should have one parameter at the primary constructor and use val or var, cannot be open, abstract,inner or sealed and can only implement interfaces. Data class has the following members: You can read more here. Kotlin – Classes Part 3 Properties Kotlin – Number conversion Kotlin – Classes Part 2 Inheritance Kotlin – Data Classes

Kotlin – Data Classes Read More