[89] in java-interest

home help back first fref pref prev next nref lref last post

Overloading of "+" for string concat

daemon@ATHENA.MIT.EDU (Scott Hudson)
Tue May 16 20:52:15 1995

From: hudson@cc.gatech.edu (Scott Hudson)
To: java-interest@java.Eng.Sun.COM
Date: Tue, 16 May 1995 19:51:43 -0400 (EDT)

I ran across an interesting feature/bug last night which makes me
wonder if overloading "+" as string concatenation is such a good idea.
The following code:

  int i = 1; int j = 0; System.out.println("Test: " + i+j);

produces "10" when many readers might expect "1".  Seems like an argument
for introducing a new operator for string concatenation.  Maybe "::"?

Scott Hudson
http://www.cc.gatech.edu/gvu/people/Faculty/Scott.E.Hudson.html


-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post