Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.awt.Container

 
Ajit Deshpande
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I came across a question in the JavaExams mock test:
Q)
Which category does java.awt.Container belong in?(choose one)
a: interface
b: abstract class
c: normal class
d: none of the above
The correct answer was given as c: normal class
But the Container class is an abstract class so the right answer should be b:.
or am I missing something.
Please help.
 
Paul Smiley
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm pretty sure that as of Java 2, Container is no longer abstract.
 
Ajit Deshpande
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 9 of the RHE book under the section 'Containers and Components' says "The container class is abstract: its most commonly used concrete subclasses are Applet, Frame and Panel." Patrick Naughtons book on Java2 does'nt say anything about the class being abstract.
Confused?
Can anybody help please?
 
Eric Barnhill
Rancher
Posts: 233
Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Container was abstract in 1.1 but is not abstract in 2. What you would do with one is another matter. I've never actually seen it used.
Always check the RHE with the Errata at their site. The earlier versions have a lot of errors. Perhaps someone can provide the link.
Eric
 
Suma Narayan
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ajith,
I think you have the older version as the latest version which I have clearly says that Container class was abstract, but now it is'nt. As Eric says, please always check the errata. The link is here.
Suma
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Contianer class is not abstract, however Component is ..I think you are confusing both of them ..Container implements the methods of Component
 
Ram Nath
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Container class is a normal class in Java 2.0. It was an abstract in 1.1.
Ram
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic