T
Thomas
Hello I 'm new to java and I want just to ask about the shortest possible
way to read user input from console. I found this :
char tmp;
Integer liczba = new Integer (0);
StringBuffer buffer;
buffer=new StringBuffer();
while((tmp = (char)System.in.read())!='\n')
buffer=buffer.append(tmp);
liczba=Integer.parseInt(buffer.toString().trim());
Since in c++ it does take significantly less code to implement.
way to read user input from console. I found this :
char tmp;
Integer liczba = new Integer (0);
StringBuffer buffer;
buffer=new StringBuffer();
while((tmp = (char)System.in.read())!='\n')
buffer=buffer.append(tmp);
liczba=Integer.parseInt(buffer.toString().trim());
Since in c++ it does take significantly less code to implement.