jQuery in Action, 2nd edition
The moose likes Beginning Java and the fly likes convert primitive int to Object Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "convert primitive int to Object" Watch "convert primitive int to Object" New topic
Author

convert primitive int to Object

harish pathak
Ranch Hand

Joined: Dec 17, 2005
Posts: 51
Hi All,

I have to convert primitive int to Object.
How it is possible.

Please reply soon

I am getting error while executing following code..

request.setAttribute("fabricatorid",fabricatorid);
request.setAttribute("bannerid",bannerid);



as fabricatorid is int and it required Object.

Thanks
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26213
    
  66

Harish,
Try:


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Kentaro Shinbashi
Greenhorn

Joined: Jun 08, 2006
Posts: 15
Harish,

I recommend reading the java tutorial section about the wrapper classes Integer, Boolean, Float, and Double. Also, the api docs.

This will give you a general idea of how to pass ints as objects, floats as objects, etc.


It helped me a lot in figuring out solutions.

Kentaro
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: convert primitive int to Object
 
Similar Threads
Wrapper's String Constructor
Returning a boolean value in a object return method
conversions
difference between parsexxx() and valueOf()
Difference between int and Integer