println-Bug in Java

Bojan Antonovic bojan@antonovic.com
Wed Mar 16 16:32:00 GMT 2005


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! :)
Bojan


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /