| Author |
Abstract class - Whetehere sub class should implement all the abstract methods of base class ?
|
kri shan
Ranch Hand
Joined: Apr 08, 2004
Posts: 1300
|
|
public abstract class Vehicle {
abstract int total();
}
public class Car extends Vehicle {
}
Is it mandatory to implement abstract method total in the sub class Car?
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56168
|
|
|
No. But if you don't, Car must also be abstract.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
In other words, if the class is not abstract then yes. After all, a non-abstract class can have no abstract methods, even not inherited from an abstract super class.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: Abstract class - Whetehere sub class should implement all the abstract methods of base class ?
|
|
|