Marker Interface in Java

Marker interface in Java is an interface with empty body. A marker interface does not contain constants or methods, examples of marker interface in Java are- java.util.RandomAccess java.rmi.Remote java.io.Serializable java.lang.Cloneable Marker interface adds special behavior Since marker interface is an empty interface so there are no methods to implement. It…

Continue reading

Initializer Block in Java

When you create an instance of a class, constructor is called to initialize the instance variables. An alternative to using a constructor to initialize instance variable is to use initializer block in Java. Initializer block is always executed when an instance of the class is created. General form of Initializer…

Continue reading

Class in Java

A class is the foundation for object oriented programming in Java language. Any logic that has to be implemented in Java must be encapsulated with in the class. Once a class is created in Java that defines a new data type which can be used for creating object of that…

Continue reading