What is meant by Inheritance and what are its advantages?

Inheritance is the process of inheriting all the features from a class. The advantages of inheritance are reusability of code and accessibility of variables and methods of the super class by subclasses. In Java, inheritance is a mechanism that allows one class to inherit the properties and behaviors (fields and methods) of another class. The … Read more

What is difference between overloading and overriding

a) In overloading, there is a relationship between methods available in the same class whereas in overriding, there is relationship between a superclass method and subclass method. b) Overloading does not block inheritance from the superclass whereas overriding blocks inheritance from the superclass. c) In overloading, separate methods share the same name whereas in overriding, … Read more

What is method overloading and method overriding

Method overloading: When a method in a class having the same method name with different arguments is said to be method overloading. Method overriding : When a method in a class having the same method name with same arguments is said to be method overriding. In Java, method overloading and method overriding are two important … Read more

What are Transient and Volatile Modifiers?

Transient: The transient modifier applies to variables only and it is not stored as part of its object’s Persistent state. Transient variables are not serialized. Volatile: Volatile modifier applies to variables only and it tells the compiler that the variable modified by volatile can be changed unexpectedly by other parts of the program. In Java, … Read more

What is finalize() method?-

finalize () method is used just before an object is destroyed and can be called just prior to garbage collection. In Core Java, the finalize() method is a method provided by the Object class. It is called by the garbage collector when it determines that there are no more references to the object. The purpose … Read more