Java - Abstract Classes
If I declare class as abstract with no abstrac开发者_StackOverflowt methods declared in it, will it give a compilation error ?
Two minutes with your compiler would've told you the answer to that is "no".
Not at all. An abstract class with no abstract methods can be used to signify a base class that is intended to be extended, but for which a concrete instance does not make sense.
It will not give compiler error. but it dosen't make any sense by using abstract keyword.
Abstract class declared with the keyword ‘abstract’, abstract class may or may not contain abstract method but if a Class has an abstract-method then the class is known as abstract class.
Abstract classes cannot be instantiated, but they can be sub-classed,
When an abstract class is sub-classed, the subclass usually provides implementations for all of the abstract methods in its parent class.
精彩评论