a) An abstract method cannot be final b) An abstract method cannot be static c) An abstract method cannot be private d) An abstract method must be specified inside an abstract class only e) An abstract method cannot throw any exceptions Select all valid answers. The answers mentioned were (a),(b),(c)&(d).Should (d) be included since,abstract methods can also be specified within an interface ?
Hiya, An interface cannot have a static member, according to the JLS 2nd Ed. 9.4 Note that a method declared in an interface must not be declared static, or a compile-time error occurs, because static methods cannot be abstract. End Quote.
All methods within an interface are implicitly abstract since there is no implementation. And they are implicilty public, so you cannot declare any private methods (however, you can implement private members in the implementation). A method declared within an interface may not be declared as final, although the implementation of the method in a class that implements the interface can be declared as being final. Methods defined within an interface can be declared as throwing an exception.