| JDK 20 | JDK 21 |
|---|---|
| 20 b28Fixed | 21Fixed |
|
Blocks :
|
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.
|