-
Bug
-
Resolution: Fixed
-
P3
-
9
-
b142
-
Verified
Recent fixes have addressed program input in the jshell tool. So now:
System.in.read()
works.
However, as reported by Paul Deitel --
...
For example, should I be able to use a Scanner object?
The following creates one
Scanner input = new Scanner(System.in);
But if I then type
int x = input.nextInt();
it appears to execute the statement and wait for input, but I can’t get that input to work. After typing a number and pressing Enter, I just get a blank line. I then have to type Control C to terminate the input. At this point JShell shows
x ==>
and evaluating x then gives 0.
One of the most basic things a new programming student will do is use command-line input statements. I realize they can simply say something like
int x = 32;
but once we show them JShell, they’re sure to try out the above input capability too.
Best,
Paul
System.in.read()
works.
However, as reported by Paul Deitel --
...
For example, should I be able to use a Scanner object?
The following creates one
Scanner input = new Scanner(System.in);
But if I then type
int x = input.nextInt();
it appears to execute the statement and wait for input, but I can’t get that input to work. After typing a number and pressing Enter, I just get a blank line. I then have to type Control C to terminate the input. At this point JShell shows
x ==>
and evaluating x then gives 0.
One of the most basic things a new programming student will do is use command-line input statements. I realize they can simply say something like
int x = 32;
but once we show them JShell, they’re sure to try out the above input capability too.
Best,
Paul