Hi,
I am using JDK 1.6 and creating a simple program in which I need to accept an integer value from the keyboard. I am using the following code to do it
int a = (int) System.in.read();
It works but when I print the value it is not the same as inserted.
What's the problem ......... ?
Please Reply!!!
Keyboard Input in Java
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Deepak VermaRank #672 · 3.6K reputationPosted Jul 19, 2011, 2:09 AM EDT
The line of code, you are using is just convert the input char or first char of string to its ASCII value.
You may use this code to accept input from keyboard
BufferedReader BRd = new BufferedReader(new InputStreamReader(System.in));
String temp = BRd.readLine();
Integer.parseInt(temp);
Note: Don't forget to import System.io.*
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Jul 19, 2011, 2:11 AM EDT
Please post the entire code.
Legolas54 reputationPosted Jul 19, 2011, 3:58 AM EDT