File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
video training course this week in the
Programmer Certification (SCJP/OCPJP)
Qn on Wrapper classes.
Joined: Apr 19, 2006
Apr 25, 2006 02:09:00
Look at the following snippet of code from Marcus green mock exam
Integer ten = new Integer(10);
Long nine = new Long (9);
System.out.println(ten + nine);
System.out.println(i + ten);
Output is 19 followed by 11.
But what anwer says is :
Compile time error
The wrapper classes cannot be used like primitives.
Why the diff. I am using
Will the output be diff. if I use sdk 1.4.
Joined: Mar 20, 2006
Apr 25, 2006 02:12:00
Only from 1.5 you having unboxing
This code is valid only from 1.5 so in 1.4 its a compiler error
Joined: Feb 24, 2006
Apr 25, 2006 02:48:00
You can use the -source 1.4 option to see what would happen with java 1.4
SCJP 6 articles
SCJP 5/6 mock exams
More SCJP Mocks
I agree. Here's the link:
subject: Qn on Wrapper classes.
Marcus Mock #25
operations on wrapper classes
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015