• Post Reply Bookmark Topic Watch Topic
  • New Topic

Difference between java1.4 and java5  RSS feed

 
Sunni srivastav
Greenhorn
Posts: 24
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class Convert {
2. public static void main(String[] args) {
3. Long xL = new Long(456L);
4. long x1 = Long.valueOf("123");
5. Long x2 = Long.valueOf("123");
6. long x3 = xL.longValue();
7. Long x4 = xL.longValue();
8. Long x5 = Long.parseLong("456");
9. long x6 = Long.parseLong("123");
10. }
11. }

Which will compile using Java 5, but will not compile using Java 1.4? (Choose all that apply.)
A. Line 4
B. Line 5
C. Line 6
D. Line 7
E. Line 8
F. Line 9

Please help with this code as I have never worked with java1.4 and also provide the explanation if possible.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The term to read up on is "auto boxing".
 
Campbell Ritchie
Marshal
Posts: 56593
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... and welcome to the Ranch
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello abhinav ashok, welcome to the Ranch.

When you copy a question from a book, mock exam or other source, we require you to quote your sources. In other words, please tell us from what book or website you copied the question.

So, can you please tell us that?
 
Sunni srivastav
Greenhorn
Posts: 24
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper de Jong wrote:Hello abhinav ashok, welcome to the Ranch.

When you copy a question from a book, mock exam or other source, we require you to quote your sources. In other words, please tell us from what book or website you copied the question.

So, can you please tell us that?

If i was knowing the source then definately i would have written that but it was given in my java tuitions..so no idea about source..sorry
 
Campbell Ritchie
Marshal
Posts: 56593
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something your lecturer wrote? That counts as a source, but it would be a good idea to tell us which college you are at.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!