Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can you increment letters?

 
Fred Abbot
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
I have a String which is the letter A is there anyway i can dynamically chane it to B ?
obviously A + 1 = A1
but is there something similar for letters?
thank you
 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI
If it's just letters you want why not use char??
The code below prints out j and then k.

Hope that helps,
Terry Doyle
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember, Strings are immutable, so there is nothing that you can do to dynamically or explicitly change the value of a string.
The suggestion to use chars is a good one. Remember that chars are primitive in Java.

------------------
Brian Hoff
Sun Certified Programmer for the Java� 2 Platform
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic