CEN206 Object-Oriented Programming
Java Abstract Method Review
- A method that doesn't have its body is known as an abstract method. We use the same abstract keyword to create abstract methods. For example,
abstract void display();
Here, display() is an abstract method. The body of display() is replaced by ;.
If a class contains an abstract method, then the class should be declared abstract. Otherwise, it will generate an error. For example,
class Language {
abstract void method1();
}