This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 1371
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: 60800
    
  65

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: 19655
    
  18

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
 
 
subject: Abstract class - Whetehere sub class should implement all the abstract methods of base class ?
 
Similar Threads
Abstract Class
method Overriding - Class Bus extends Vehicle, Class Car extends Vehicle
Super class constructors
casting
Overriding/overloading