Java instance initializers are code blocks which are executed before the constructor code is executed. These initializers run everytime we create a new object.
In Java, extends is used for extending a class and implements is used for implementing the interfaces. It’s the main difference between extends vs implements. 1. extends keyword In Java, we can inherit the fields and methods of a class by extending it using extends keyword. Please note that in Java, a class can extend […]
Java instanceof operator (also called type comparison operator) is used to test whether the object is an instance of the specified type (class or subclass or interface). It returns – true – if variable is instance of specified class, it’s parent class or implement specified interface or it’s parent interface false – if variable is […]
Java constructors are special methods (without return type) which allow you to fully initialize the object state before it can be used by other classes inside application. Constructors in java are invoked using new keyword.
Inheritance in java (IS-A relationship) is referred to the ability where child objects inherit or acquire all the properties and behaviors from parent object. In object oriented programming, inheritance is used to promote the code re-usability.