Introduction to Object-Oriented Programming in Java
Sani Yusuf
Lead Software Engineering Content Developer
// Car abstract class
abstract class Car {
// abstract drive method
abstract void drive(); // No Code Implementation
}
// Car abstract class
abstract class Car {
// abstract drive method
abstract void drive(); // No Code
// implementation
}
// Toyota class
class Toyota extends Car {
void drive(){
// Toyota drive() implementation
}
}
// Porsche class
class Porsche extends Car {
void drive(){
// Porsche drive() implementation
}
}
// abstract Car class
abstract class Car {
private int topSpeed;
// Concrete method with implementation
public getTopSpeed(){
return this.topSpeed;
}
abstract void drive();
// No Code Implementation
}
Introduction to Object-Oriented Programming in Java