wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes does an abstract method require an abstract class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "does an abstract method require an abstract class?" Watch "does an abstract method require an abstract class?" New topic
Author

does an abstract method require an abstract class?

Mike Noel
Ranch Hand

Joined: Dec 15, 2005
Posts: 108
If I have a method marked as abstract it seems to make sense that the class would also have to be marked abstract. Right?


Mike Noel
Doyle Matt
Ranch Hand

Joined: Jul 05, 2004
Posts: 76
marked method?

are you referring to annotations? if not then is a method is "declared" abstract then its class declarations should also be "declared" abstract as well.


SCJP 1.4
Mike Noel
Ranch Hand

Joined: Dec 15, 2005
Posts: 108
Yes, sorry for the confusion. I mean declared abstract.
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
... or it should not be a class but interface.
Revathi Velu
Greenhorn

Joined: Jun 19, 2006
Posts: 8
If a method is abstract then the class containing the method MUST be abstract. You cannot have an abstract method inside a non-abstract clas.

The converse however is not true. You can have one or all non-abstract methods inside an abstract class.

Hope this helps.

Revathi


Thanks<br />Revathi
Douglas Chorpita
Ranch Hand

Joined: May 09, 2006
Posts: 97
Great job, Revathi!!


SCJP 1.4 - 95%
 
wood burning stoves
 
subject: does an abstract method require an abstract class?
 
Similar Threads
Abstract class
problem in running abstract class
strictfp and abstract
Advantages of abstract class in ejb2.0
abstract / non abstract class