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

Code typo in Local Classes in tutorial

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • None
    • None
    • docs
    • None

      In https://docs.oracle.com/javase/tutorial/java/javaOO/localclasses.html

                  PhoneNumber(String phoneNumber){
                      // numberLength = 7;
                      String currentNumber = phoneNumber.replaceAll(
                        regularExpression, "");
                      if (currentNumber.length() == numberLength)
                          formattedPhoneNumber = currentNumber;
                      else
                          formattedPhoneNumber = null;
                  }

      numberLength = 7 => // numberLength = 10

      Or, better clarify that the code is being changed that correct numbers only have seven digits (the point of this assignment is to demonstrate effectively final variables.


            rgallard Raymond Gallardo
            rgallard Raymond Gallardo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: