Kris
06-21-2002, 11:33 AM
I have a Java question, which I'm pretty sure has a simple answere:
To read an integer typed from the user, one can use:
int keyPressed = System.in.read();
But this only goes for integers.
What I want to do is to read a number typed by the user (double or float) and to multiply that number with itself. If I multiply the userinput from an integer, I mulitply the binary value of that letter or number, don't I? So, 2 * 2 somehow seems to become 2500, which is, obviously, not correct. My question is therefore: Which other simple method can I use to read an input from the user?
Kris
To read an integer typed from the user, one can use:
int keyPressed = System.in.read();
But this only goes for integers.
What I want to do is to read a number typed by the user (double or float) and to multiply that number with itself. If I multiply the userinput from an integer, I mulitply the binary value of that letter or number, don't I? So, 2 * 2 somehow seems to become 2500, which is, obviously, not correct. My question is therefore: Which other simple method can I use to read an input from the user?
Kris