[959] in java-interest
Re: Operator Overloading
daemon@ATHENA.MIT.EDU (Philip Brown)
Tue Aug 15 22:36:29 1995
To: java-interest@java.Eng.Sun.COM
Date: Tue, 15 Aug 1995 16:22:19 -0700 (PDT)
In-Reply-To: <9508151625.AA27876@alapa.Eng.Sun.COM> from "Thomas Ball" at Aug 15, 95 09:25:30 am
From: phil@bolthole.com (Philip Brown)
Ah, an old "post"...
Since the original attribution was lost, I shall attempt to reply to an
anonymous sender.
> > Which of these is simpler to understand?
> >
> > String a = "Hello ";
> > String b = "world.";
> > String c = a + b;
> >
> > or
> >
> > String a = "Hello ";
> > String b = "world.";
> > String c = new String(a);
> > c.concat(b);
I would have to say choice 3:
String a = "hello ";
String b = "world.";
String c = String.concat(a,b);
> >
> > To me, the first example is more intuitive and obvious.
No, the first example has shorter characters. Which may make you more
*comfortable*, in typing it , and/or reading it.
But it is in no way "intuitive".
As others have pointed out, "+" is ambiguious for anything
other than integers. If you get creative, it can even be ambiguous for
strings. So I sort of wish sun did NOT put that in for strings.
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com