File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Abstract class - Whetehere sub class should implement all the abstract methods of base class ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Abstract class - Whetehere sub class should implement all the abstract methods of base class ?" Watch "Abstract class - Whetehere sub class should implement all the abstract methods of base class ?" New topic
Author

Abstract class - Whetehere sub class should implement all the abstract methods of base class ?

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1382
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: 61764
    
  67

No. But if you don't, Car must also be abstract.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19784
    
  20

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 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Abstract class - Whetehere sub class should implement all the abstract methods of base class ?