Answer Posted / shadow
//command line argument as string
public class StringReverse
{
public static void main(String[] args)
{
String string=args[0];
String reverse = new StringBuffer(string).reverse
().toString();
System.out.println("\nString before reverse:"+string);
System.out.println("String after reverse:"+reverse);
}
}
output:
C:\java\jdk>javac StringReverse.java
C:\java\jdk>java StringReverse "SHADOW"
String before reverse:SHADOW
String after reverse:WODAHS
| Is This Answer Correct ? | 8 Yes | 2 No |
Post New Answer View All Answers
Is java a pure object oriented language?
What is the size of boolean variable?
How can constructor chaining be done using this keyword?
How can you add and remove nodes in jtree?
How are observer and observable used in java programming?
Write a program in java to calculate the difference between the sum of the odd level and even level nodes of a binary tree.
Explain with example the concept of constant variable in java.
How do you check if a character in a string is a digit or letter?
How can you read an integer value from the keyword when the application is runtime in java? example?
Where can I find jdk in my computer?
What is included in core java?
what is the use of bean managed and container managed with example?
Which sorting algorithm is best in java?
Why is java called java?
What is the purpose of void?