Overriding

Java Made Simple: Java final method overriding with Example

Java final Method : final keyword can be applied to methods apart variables and classes. The main advantage of declaring a method final is to prevent subclass to override. Let us go through a simple program on final method. class Test { public final void display() // it is final method and cannot be overridden …

Java Made Simple: Java final method overriding with Example Read More »

Can we override static method in Java with Example?

The super class static methods cannot be overridden by sub class because they do not represent the state of the object or with static methods no encapsulation exists. For this reason, the super class static methods are not part of subclass. When they are not part of subclass, they cannot be overridden. Let us write …

Can we override static method in Java with Example? Read More »

Java Made Clear: Difference Static binding Dynamic binding

Difference Static binding Dynamic binding Java, being an OOPs language, supports both static binding and dynamic binding. Coming to our topic, a class may have overloaded and overridden methods. When to call which method is decided (binded) sometimes by compiler and sometimes by JVM at runtime. Why this disparity? Why Java is designed like this? …

Java Made Clear: Difference Static binding Dynamic binding Read More »

Method overloading vs Method Overriding Java

Method overloading and method overriding are two concepts supported by a OOPs language. Method overloading Definition: Using the same method number of times in the same class but with different parameters is known as method overloading. Advantages: The same method call gives different outputs when called different times. For example, getArea() method may give sometimes …

Method overloading vs Method Overriding Java Read More »