aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes abstract class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "abstract class" Watch "abstract class" New topic
Author

abstract class

swapnil paranjape
Ranch Hand

Joined: May 15, 2005
Posts: 126
please help me out :

Which of the follow statements is true.

a. An anonymous class can be declared abstract.
b. A local class can be declared abstract.
c. An abstract class can be instantiated.
d. An abstract class is implicitly final.
e. An abstract class must declare at least one abstract method.
f. An abstract class can not extend a concrete class.


ans is :b

i thought ans should be b and e.

why e is not the ans?
if we dont have any abstract method in the abstract class then whats the use of making class abstract(if all the methods have their implementation)
Oscar Gonzalez
Ranch Hand

Joined: Mar 28, 2006
Posts: 63
To have such a class it's probably stupid, but that doesn't mean that is not legal.
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023
An abstract class is not required to have an abstract method in it.

Any class that has an abstract method in it or that does not provide an implementation for any abstract methods declared in its superclasses or implemented interfaces must be declared as an abstract class.
Gianfranco Cecconi
Greenhorn

Joined: May 14, 2006
Posts: 1
The rule of thumb I use about abstraction and the relationship between classes and their methods is "Only abstract class can have abstract methods": once this is verified, everything else is possible. Hope I'm not wrong :-)
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
e is not correct because a class can simply be declared abstract even if it contains no methods.
Kishore Balla
Ranch Hand

Joined: Jun 08, 2005
Posts: 165
Originally posted by Keith Lynn:
e is not correct because a class can simply be declared abstract even if it contains no methods.


Example for above is javax.servlet.http.HttpServlet
[ May 30, 2006: Message edited by: Kishore Balla ]

SCJP 5.0 : 88% My Story, SCWCD 1.4 : 94% My Story
kishoreballa.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: abstract class