wood burning stoves 2.0*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Convert object to char primitive
 
Similar Threads
return type of charAt()?
How to convert set to char[]?
?a?
How Set Class for Reflection of Method with Param: char[]
Returning a boolean value in a object return method