Re: increment letters



On Tue, 31 Jul 2007 20:16:37 -0000, Twisted <twisted0n3@xxxxxxxxx>
wrote, quoted or indirectly quoted someone who said :


add(new JButton(""+'A'+i));

This works in C; less sure about Java. There's also:

That won't work. The problem is + promotes 'A' to an int. You then
effectively have ""+ 65 which will generate the string "65".

There are a number of related gotchas. See
http://mindprod.com/jgloss/gotchas.html#CONCATENATION
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
.


Quantcast