Inheritance in Java

Inheritance is the way through which a class acquires all the properties and members of other class. Inheritance represents the IS-A relationship. The class acquiring the properties is called child class and the class from which properties are acquired is called parent class. We make use of ‘extends‘ keyword for inheritance. With inheritance the child … Read more

Constructor Chaining in Java

Constructor chaining is the way through which a constructor make a call to another constructor. Constructor chaining can be done in 2 ways: Output In the above code we called Example2() constructor for object creation which in turn calls Example2(int age) constructor using this(29). Now inside Example2(int age) constructor a call is made to Example2(int … Read more