• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Boolean doubt - simple

 
raja kanak
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
6) Which of the following are acceptable?
1) Object o = new Button("A");
2) Frame f = new Panel();
3) Boolean flag = true;
4) Boolean flag = true;
5) Panel p = new Applet();

Answer for the above, in a mock, mentioned as 1 & 5
But i thought, it is 1, 3,4 & 5
Am i right?
 
Andy Morris
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Was the mock for Java 5 or 1.4?

Answers 3 and 4 (which both are the same so i wonder if you've typed it incorrectly) use autoboxing which was a new feature in Java 5.
 
raja kanak
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the mock found at http://www.4tests.com/
question number is 6
 
Andy Morris
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That exam is for the 1.4 certification.

That means special features of the language such as autoboxing will not be present and so wrapper objects like Boolean can not be assigned primitive values such as 'true'.

You need to decide which certification you'd prefer (I can't really see why you'd go for 1.4 when you can do the Java 5 one instead), and then choose mock exams appropriately or ignore questions that aren't compatible between the two exams.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It does not look like SCJP 1.4 to me. The question looks as if it is from SCJP 1.2!
 
raja kanak
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Im preparing for scjp 1.5
Thanks for saving from 1.4 trap.
suggest me some really 1.5 mocks, please
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic