Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-5283

Inconsistent System.out.println : "2B" does not print

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 11.3, 12.2
    • None
    • None

    Description

      The following problem was discovered accidentally by a student.

      The following class with comments summarizes the incorrect behavior seen when calling System.out.println on certain strings beginning with numerical digits and ending in a single character of either B, K, or M (upper or lower case):

      public class Hello2B {
         public static void main(String[] args) {
           System.out.println("-2B"); // THIS WILL PRINT IN NETBEANS
           System.out.println("2B"); // THIS WILL NOT PRINT IN NETBEANS
           System.out.println(" 2B"); // THIS WILL PRINT IN NETBEANS
           System.out.println("5K"); // THIS WILL NOT PRINT IN NETBEANS
           System.out.println("4M"); // THIS WILL NOT PRINT IN NETBEANS
           System.out.println("123B"); // THIS WILL NOT PRINT IN NETBEANS
           System.out.println("123BC");// THIS WILL PRINT IN NETBEANS
          }
      }

       

      NOTE: Problem does not occur when class is executed by JDK directly or by using other IDE environments.

      Attachments

        1. HelloWorld2B.java
          1 kB
          Joseph W. Haller
        2. Hello2B.java
          0.6 kB
          Joseph W. Haller

        Activity

          People

            Unassigned Unassigned
            jwhaller Joseph W. Haller
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: