Java Bugs - Character.toString() bug

Character lacks a static toString method, while all the other scalar type wrappers have one. The workaround is to make a temporary instance and use the instance toString() method instead.

This deficiency is still present in JDK 1.1.

View the source code.

% javac CharBug.java
CharBug.java:12: No method matching toString(char) found in class java.lang.Character.
        b = Character.toString( a );            // this one does not work
                              ^
1 error

Back to bugs.
Back to ACME Java.
Back to ACME Labs.