• 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

Boolean doubt - simple

 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
This tiny ad is guaranteed to be gluten free.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic