Computer Science Canada

reading Double

Author:  S_Grimm [ Mon Oct 20, 2008 11:05 am ]
Post subject:  reading Double

so, i need to learn how to read double, long, short, byte, char and float. i know how to read int (using parseInt) and string (using readLine) i would like to know how to read the rest of them.

Author:  HellblazerX [ Mon Oct 20, 2008 11:28 am ]
Post subject:  RE:reading Double

Double.parseDouble ()
Long.parseLong ()
Short.parseShort ()
Byte.parseByte ()
Float.parseFloat ()

All work in the same way as parseInt ().

As for reading char, remember that Strings store char values in an array. So if you want to get input of just one character, get the input as a String, and find the character in the first position:
string.charAt (0).

Author:  S_Grimm [ Mon Oct 20, 2008 2:26 pm ]
Post subject:  RE:reading Double

thanks


: