• 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

errata or ??

 
Ranch Hand
Posts: 5399
1
Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
que is from : http://www.4tests.com/exams/questions.asp
6) Which of the following are acceptable?
[check bixes are there - RK]
Object o = new Button("A");
Frame f = new Panel();
Boolean flag = true; // 3
Boolean flag = true; // 4
Panel p = new Applet();


====
My prob is that ... I can not distinguish the diffrence betn 3 & 4 ...
is it same with every one ...
is it errata
TIA
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yeah I think it is an errata... Typical cut-paste problem...
I'm moving this to Mock Exam Errata
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I met the same question in John Hunt Mock exam. Could anyone explain to me why
---------------------------
Boolean flag = true; // 3
---------------------------
is not acceptable? Thanks a lot!
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
because:
Boolean flag = true
tries to assign the boolean literal true to a reference variable of type Boolean (which is a class)...
boolean flag = true
and
Boolean flag = new Boolean("true")
Boolean flag = new Boolean(true)
are valid statements.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic