Example code in Scanner class

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 20
    • Affects Version/s: None
    • Component/s: core-libs
    • b28
    • generic
    • generic

        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.

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

                Created:
                Updated:
                Resolved: