• 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

Wrapper class doubt??

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

The code below is what I tried with a 1.5 JRE.

ArrayList a = new ArrayList();
a.add(new Short((byte)22));
a.add(new Integer((int)22.34));
a.add(new Long((int)22.34));
System.out.println(a);

I want to know is this also holds good with a 1.4 compiler?? Ranchers help me please, as I don't have a 1.4 compiler...Can anyopne let me know this??
 
Ranch Hand
Posts: 1252
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jothi Shankar Kumar Sankararaj:
Guys,

The code below is what I tried with a 1.5 JRE.

ArrayList a = new ArrayList();
a.add(new Short((byte)22));
a.add(new Integer((int)22.34));
a.add(new Long((int)22.34));
System.out.println(a);

I want to know is this also holds good with a 1.4 compiler?? Ranchers help me please, as I don't have a 1.4 compiler...Can anyopne let me know this??



Yes it would definately work on 1.4 compiler. But why you asked this question, is there anything which is not present in JDK 1.4 ....


Well Anyways, I can confirm you that it will run smoothly in JDK 1.4 and will give output as [22,22,22]...

Hope it helps you out.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for confirming. I got confused with the boxing and autounbox feature that was not there with the 1.4 version.
reply
    Bookmark Topic Watch Topic
  • New Topic