Friday, March 26, 2010

10 - abstract

a) If an abstract method is not visible in a subclass then that subclass is abstract even if it implements a method with same name

b) If a class inherits a method with same name as abstract method and abstract method is visible to it, then it is non abstract even if the super class from which it has inherited is abstract due to a)

c) if anywhere in the inheritance hierarchy you have a non abstract class then all it's subclasses are also non abstract unless they define an abstract method

d) polymorphism and overriding work in the same way as non abstract method.

e) runtime error- java.lang.Abstract method error occurs when you try to invoke an abstract method.

particularly at compile time you can invoke an abstract method using abstract class reference but at runtime if the actual object does not have a valid overridden method then this error will happen

No comments:

Post a Comment