abstract class a { public void abstract fun(); } interface B { void fun(); } public class c extend a implements B { public static void main(String arg[]) { how to call abstract method of class and interface. } } clarify my doubt with syntax
Originally posted by naresh dharami vatsal: abstract class a { public void abstract fun(); } interface B { void fun(); } public class c extend a implements B { public static void main(String arg[]) { how to call abstract method of class and interface. } } clarify my doubt with syntax
If you observe,does it matter which method will be called ,since no method ,no fun() is having implementation. Because of no- body in both Abrstract class or interface ,we cant call with their methods without implementor-class-object.
When implemented in some class, class x extends a implements b { public void fun() //this methd comes from a or b,doesnt matter,its template only with same signature in both { ...implementation ..code ...
}
when you call ,objectofx.fun() ,now belongs to class x- instance. you cant say a.fun() or b.x(); since they have no implementation.