This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Getting started with Java programming language and have Ashish Sarin & J Sharma on-line!
See this thread for details.
Win a copy of Getting started with Java programming language this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to get reverse string  RSS feed

 
nagarjuan pula
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

can any one can explain how to display the given string as reverse string. if you have example code post that.

thanks in advance.
 
sampath premarathna
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this will help you

String as="htapmas";
String temp="";
for(int x=as.length()-1;x>-1;x--){
temp+=as.charAt(x);
}
System.out.println(temp);
 
Eduardo YaƱez Parareda
Ranch Hand
Posts: 93
IntelliJ IDE Java VI Editor
 
nagarjuan pula
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you sampath.its working
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!