0
Why we create abstract method insted of normal method? At the first place
abstract class A { abstract void display (); } class B extends A { void display(){ System.out.println(" Why i am not created on the first place? "); } } class Main{ public static void main (String[]ar){ A obj = new A(); obj.display(); } }
1 Antwort
+ 5
In some cases, there's no common behavior for a method in the super class and you want each sub class to have its own implementation of that method, you'd make that method in super class abstract.