This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

println-Bug in Java


I see this bug in GCJ 3.4.3 and in javac 1.4.2_05:

public class PrintTest {

       public static void main(String[] args) {
               // separate:
               System.out.println(9);
               System.out.println('a');
               System.out.println("a");

               System.out.println('a'+9);
               System.out.println(9+'a');

               //combined:
               System.out.println("a"+9);
               System.out.println(9+"a");

               System.out.println("a"+'9');
               System.out.println('9'+"a");

               System.out.println('a'+9.0);
               System.out.println(9.0+'a');

               System.out.println("a"+9.0);
               System.out.println(9.0+"a");
       }

}

output is:

9
a
a
106
106
a9
9a
a9
9a
106.0
106.0
a9.0
9.0a

So println with a char and a number (int or double) works wrong! I tested it with javac and

gcj --main=PrintTest PrintTest.java

Why ist his bug not fixed? Should I make an entry in bugzilla ?

Bojan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]