Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what is parseInt in char?

Status
Not open for further replies.

R17

Programmer
Jan 20, 2003
267
PH


i use this to ask input from my user of type integer,

Code:
no1 = Integer.parseInt(br.readLine()) ;

i want to ask for a char... but using the code gives me an error.

what's is the equivalent of parseInt in char?


 
Try to use method "int read ()" defined in BufferedReader.

This method reads a single character, from the Java doc :
"Returns : The character read, as an integer in the range 0 to 65535 (0x00-0xffff), or -1 if the end of the stream has been reached "

Code:
char char_read = (char) br.read ();

--
Globos
 
String x = br.readLine();
if(Character.isAlpha(x.charAt(0))) {
}

Double check the method though, b/c I'm not sure it's isAlpha or isCharacter or what. java.lang.Character
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top