This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization 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