• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

why(boolean b3=true;)(Boolean b4=true;)is both right?

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
shoud'nt be
Boolean=new Boolean(true);
or
Boolean=new Boolean("true");
 
author
Posts: 23959
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am assuming that you are using Java 1.5, which is why "Boolean b4 = true" works. Java 1.5 introduced an autoboxing feature which converts between primative types and their object counterparts automatically.

Henry
 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey there, when you study for the exam, and wish to try out codes, please make sure you are using the 1.4 compiler. As mentioned, Boolean something = false works because version 1.5 introduces an autoboxing feature. But in 1.4, this is a compilation error. So please pay special attention to this, else you may study the wrong thing.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey there, when you study for the exam, and wish to try out codes, please make sure you are using the 1.4 compiler.

Unless, of course, you're studying for the 1.5 exam. The general rule is: know what exam you're preparing for, and make sure you are using the correct JDK for that exam.
 
Jianfeng Qian
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you .
Yes,I am using 1.5.
I will install 1.4 tomorrow
 
reply
    Bookmark Topic Watch Topic
  • New Topic