This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Java in General and the fly likes Convert object  to char  primitive Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Convert object  to char  primitive" Watch "Convert object  to char  primitive" New topic
Author

Convert object to char primitive

Deepa Krishnan
Greenhorn

Joined: Feb 25, 2005
Posts: 26
I am getting a object which contains a char primitive from the request,
I need to convert that object to char.

thanks in advance


SCJP 1.4
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
What kind of Object is it? Is it an instance of the Character wrapper class? If so, you can call the charValue() method to get a char primitive. If not, you need to provide some more detail. For instance, what request are you talking about? If possible, you should post some code to illustrate what you are trying to do.

Layne


Java API Documentation
The Java Tutorial
Deepa Krishnan
Greenhorn

Joined: Feb 25, 2005
Posts: 26
charValue() is the answer
thanks layne
[ August 02, 2005: Message edited by: Deepa Krishnan ]
Deepa Krishnan
Greenhorn

Joined: Feb 25, 2005
Posts: 26
layne,

still showing error!!

I am sending like this from jsp
<input name="SUBPROGRAM_CD" type="hidden" value=''>
Ejb receiving it like this
char subprogCode

subprogCode=((Character)request.get("SUBPROGRAM_CD")).charValue();
[ August 02, 2005: Message edited by: Deepa Krishnan ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Convert object to char primitive