• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

A question about container!

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
'cos Container is an abstract class.
 
laura_zpf
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have checked the document, but I do not find that the Container is abstract. It is defined as public class Container extends component.
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you! sampaths77! you means this question only correct in the JDK1.0 but not correct for now.
 
reply
    Bookmark Topic Watch Topic
  • New Topic