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
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply 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: 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
    
  13

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
 
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 ?
 
Similar Threads
Super class constructors
Abstract Class
method Overriding - Class Bus extends Vehicle, Class Car extends Vehicle
Overriding/overloading
casting