M
mehafi
Hi,
I've got 2 question:
1) I'd like to read a double value from console, so I wrote:
try{
char c = new char[100];
InputStreamReader isr = new InputStreamReader(System.in);
isr.read(c);
String s = new String(c);
double d = Double.parseDouble(s);
}
catch (IOException ioe) { }
Have I to write such much code to do such simple think?
In C++ I nead only:
double d;
cin >> d;
2) I need to detect is someone pres some key, without echo on console
and without press enter after key. In C++ it's like this:
char c = getch();
Is in Java something like this?
thanks in advance
I've got 2 question:
1) I'd like to read a double value from console, so I wrote:
try{
char c = new char[100];
InputStreamReader isr = new InputStreamReader(System.in);
isr.read(c);
String s = new String(c);
double d = Double.parseDouble(s);
}
catch (IOException ioe) { }
Have I to write such much code to do such simple think?
In C++ I nead only:
double d;
cin >> d;
2) I need to detect is someone pres some key, without echo on console
and without press enter after key. In C++ it's like this:
char c = getch();
Is in Java something like this?
thanks in advance