Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8297288

Example code in Scanner class

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 20
    • None
    • core-libs
    • b28
    • generic
    • generic

    Backports

      Description

        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.

        Attachments

          Issue Links

            Activity

              People

                naoto Naoto Sato
                naoto Naoto Sato
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: