Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Changing int into object

 
Manoj Paul
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

How will i change int abc into an object?
Please advice
 
Anupam Sinha
Ranch Hand
Posts: 1090
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ty looking for it here.
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
int i1=100;
Integer I1 = new Integer(i1);
Now you have Integer object.


Thanks,
 
Simon Baker
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alternatively:
 
Arnav Velimala
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With J2SE 5.0 Autoboxing feature, you can simply code like this:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic