Re: char to string ????
From: Phil... (rynes_at_ieee.org)
Date: 10/28/03
- Next message: Anthony Borla: "Re: How to set Permissions on New File"
- Previous message: Glen Herrmannsfeldt: "Re: char to string ????"
- In reply to: Glen Herrmannsfeldt: "Re: char to string ????"
- Next in thread: Glen Herrmannsfeldt: "Re: char to string ????"
- Reply: Glen Herrmannsfeldt: "Re: char to string ????"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 28 Oct 2003 22:16:38 GMT
doesn't c++ overload + for strings
"Glen Herrmannsfeldt" <gah@ugcs.caltech.edu> wrote in message
news:JEBnb.52612$e01.129874@attbi_s02...
>
> "Phil..." <rynes@ieee.org> wrote in message
> news:6xxnb.49857$Fm2.24685@attbi_s04...
> > my book says left to right also
> >
> > "Glen Herrmannsfeldt" <gah@ugcs.caltech.edu> wrote in message
>
> (snip)
>
> > > I thought it would evaluate left to right, so String s = b + a + d +
"";
> > > would be equivalent to
> > >
> > > String s = ((( b + a ) + d ) + ""; which is not what was asked for.
If
> > >you put the "" first it should work, though.
>
> > > You can also create a StringBuffer, add the chars one at a time, and
> then
> > > make a String from it.
>
> I did test it with char's before "" and it does add the value instead of
> concatenating as strings, as left to right says it should.
>
> My favorite was something like:
>
> System.out.println( 2 + "+" +2+" equals " +2+2);
>
> Personally, I think overloading the + operator was a bad idea. Notice
that
> Java doesn't allow user operator overloading, as users might apply
operators
> in confusing ways. Then again, the PL/I string concatenation operator,
||,
> was already taken.
>
> The awk concatenation operator, nothing at all, might have worked, though.
>
> -- glen
>
>
- Next message: Anthony Borla: "Re: How to set Permissions on New File"
- Previous message: Glen Herrmannsfeldt: "Re: char to string ????"
- In reply to: Glen Herrmannsfeldt: "Re: char to string ????"
- Next in thread: Glen Herrmannsfeldt: "Re: char to string ????"
- Reply: Glen Herrmannsfeldt: "Re: char to string ????"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|