Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8298663 | 21 | Naoto Sato | P4 | Resolved | Fixed | b02 |
There is one using `System.in` as:
```
Scanner sc = new Scanner(System.in);
```
With JEP 400, the default charset and console charset may differ, thus this example may result in an unexpected one if the user tries to read a String from the scanner. This should be replaced with:
```
Scanner sc = new Scanner(Console.reader())
```
so that the user would not have to take encoding into consideration.
```
Scanner sc = new Scanner(System.in);
```
With JEP 400, the default charset and console charset may differ, thus this example may result in an unexpected one if the user tries to read a String from the scanner. This should be replaced with:
```
Scanner sc = new Scanner(Console.reader())
```
so that the user would not have to take encoding into consideration.
- backported by
-
JDK-8298663 Example code in Scanner class
-
- Resolved
-
- is blocked by
-
JDK-8295803 Console should be usable in jshell and other environments
-
- Resolved
-