Remove override Solution – 1

In our last blog, we see the effect of override method, super class’s method become unused. So we have to remove override process from our program. For that we have many solution like create overloading, using super class, dynamic method dispatch and final method. In this blog we will work on override the method.

Remove override : using overloading method

class A


                void method()


                                System.out.println(“Welcome in A”);



class B extends A


                void method(int x)          // overload


                                System.out.println(“Welcome in B”);



class inh5


                public static void main(String args[])


                                B b1 = new B();

                                b1.method();     // Call to A Class

                                b1.method(0);  // Call to B Class





Welcome in A

Welcome in B


About Programs.

In this program, we change parameter of method() function and create overload method. So we have to call both method() and method(int) function from main class and we get both the output.


Video available on YouTube.


If you have any query on blog example, you can directly comment us or subscribe in website

Earn Money Online

1195total visits,2visits today


Hello, I am Maddy a Java blogger, trainer and developer

Related articles

Comments are closed.