I am on java 6. Using DataInputStream in = new DataInputStream(System.in);
to read user input. When the readLine() is deprecated. What is the work around for reading user value?
DataInputStream in = new DataInputStream(System.in);
int num;
try
{
num = Integer.parseInt(in.readLine()); //this works
num = Integer.parseInt(in); //just in doesnt work.
}
catch(Exception e)
{
}
please explain as it should when the readLine() is deprecated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…