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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "A question about container!" Watch "A question about container!" New topic
Author

A question about container!

laura_zpf
Ranch Hand

Joined: Sep 14, 2000
Posts: 30
In the list below, which subclass(es) of Component cannot be directly instantiated:
a) Panel
b) Dialog
c) Container
d) Frame
The answer is Container. But why the Container can not be instantiated directly?
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
'cos Container is an abstract class.
laura_zpf
Ranch Hand

Joined: Sep 14, 2000
Posts: 30
I have checked the document, but I do not find that the Container is abstract. It is defined as public class Container extends component.
laura_zpf
Ranch Hand

Joined: Sep 14, 2000
Posts: 30
I have checked the document, but I do not find that the Container is abstract. It is defined as public class Container extends component.
ramani2020
Greenhorn

Joined: Sep 14, 2000
Posts: 28
from Bill Brogden's Java2 Exam Cram,

Container was an abstract class in Java 1.0 and 1.1,but for the Java JDK1.2 it is no longer declared abstract.

HTH,
Ramani.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Laura,
All the options you have given can be instantiated.
In fact (d) is also correct. You can try this out:
Container c = new Container();
Ramani has correctly pointed out that Conatiner is no longer an abstract class.
Hope this helps
-sampaths
laura_zpf
Ranch Hand

Joined: Sep 14, 2000
Posts: 30
Thank you! sampaths77! you means this question only correct in the JDK1.0 but not correct for now.
 
 
subject: A question about container!