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
posted
0
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
posted
0
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
posted
0
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: 2341
posted
0
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
posted
0
Originally posted by Keith Lynn: e is not correct because a class can simply be declared abstract even if it contains no methods.