An abstract class is a class that is declared
An abstract method is a method that is declared without an implementation (without braces, and followed by a semicolon), like this:
If a class includes abstract methods, the class itself must be declared
When an abstract class is subclassed, the subclass usually provides implementations for all of the abstract methods in its parent class. However, if it does not, the subclass must also be declared
Note: All of the methods in an interface (see the
for more details visit
http://docs.oracle.com/javase/tutorial/java/IandI/abstract.html
abstract
—it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed.An abstract method is a method that is declared without an implementation (without braces, and followed by a semicolon), like this:
abstract void moveTo(double deltaX, double deltaY);
abstract
, as in:public abstract class GraphicObject {
// declare fields
// declare non-abstract methods
abstract void draw();
}
abstract
.Note: All of the methods in an interface (see the
Interfaces
section) are implicitly abstract, so the abstract
modifier is not used with interface methods (it could be—it's just not necessary). for more details visit
http://docs.oracle.com/javase/tutorial/java/IandI/abstract.html
No comments:
Post a Comment