Details
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.