In this example we are going to reverse a given string.
This example takes values from command line
argument as string, buffers the input string by using the StringBuffer(String string)
method, reverse the buffered string and converts this buffered string into
the string by using the toString() method. Note that pass the words
within " " to wrap the words into a single string value at
the command line argument.
The code of the program is given below:
The output of the program is given below:
C:\rajesh\kodejava>java StringReverseExample "hi how are you."
String before reverse: hi how are you. String after reverse: .uoy era woh ih
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: July 6, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles