This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: println-Bug in Java
Bojan Antonovic wrote:
Per Bothner wrote:
Bojan Antonovic wrote:
So println with a char and a number (int or double) works wrong!
No. Read the specification of '+' in the Java Language Specification.
I read it.
Why ist his bug not fixed?
Because it's not a bug.
System.out.println('a'+'b') gives 195. + for Strings means
concatenation. + for chars should return Strings, and not interpreting
them as numbers and adding them. So for me this is a bug in the Java
Language Specification, because it leads to misbehaviour.
For me, this thing is cleared, and I don't want to polute
java@gcc.gnu.org with discussions about facts they can't change! :)
Per is correct, you are mistaken.
The JLS v2 section 2.6.10 specifies what should happen in the case of
numeric operands. In the case of two char operands they both get
promoted to int.
David Daney.