Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
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
Forum:
Programmer Certification (OCPJP)
Will this compile in 1.4.??????
Srikanth Iyer
Ranch Hand
Posts: 52
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
class Tp
{
public static void main(
String
args[]) throws Exception
{
String a = "Blue";
Boolean b[] = new Boolean[1];
if(b[0])
{
System.out.println(a);
}
}
}
Sorry i was not able to get an 1.4 compiler...
The above code compiles fine in 1.5
ahmed yehia
Ranch Hand
Posts: 424
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Even with 1.5 Compiler you can still compile with older versions:
javac -source 1.4 myClass.java
Srikanth Iyer
Ranch Hand
Posts: 52
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thank you Ahmed........
Srikanth Iyer
Ranch Hand
Posts: 52
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
The code compiles in 1.5 but not in 1.4 is this because of autoboxing........
ahmed yehia
Ranch Hand
Posts: 424
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Yes, because you are passing
Boolean
object to the 'if' statement, with 1.5 Compiler it got auto unboxed to
boolean
primitive to satisfy the 'if' argument.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Boolean.valueOf method
equals()
Best way of matching substring
One more on wrapper classes from Dan's mock exam..
toString method
More...