[Bluej-discuss] concatenating an index value with a note ex 4.15

Gordon Royle gordon at csse.uwa.edu.au
Thu Oct 5 13:09:46 BST 2006


On 05/10/2006, at 6:34 PM, Rudi Lutz wrote:

>
> PS I wouldn't mind the "auto-conversion" if a different symbol had
> been used for concatentation. It can be explained to beginners as
> concatenating a "printing form" of objects/values, and later they can
> be told about the toString() method.

Yes, if there were some other indication that the whole thing was  
being treated as a String, then the auto-conversion would not cause  
confusion... So an alternative symbol would be the solution - PHP  
uses "." which I find quite intuitive though I guess in Java it would  
get confused with all the other dots.

When I am feeling grumpy I sometimes set my students the task of  
working out why

5 + 6 + "hello"

and

"hello" + 5 + 6

evaluate to the things they evaluate to...

Gordon


More information about the bluej-discuss mailing list