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
Give us a program to check for parenthesis matching using stack.
Can list be null in java?
What is primitive data type in java?
What are accessor methods in java?
When should we create our own custom exception classes?
What's the difference between comparison done by equals method and == operator?
What is immutability in java?
Where pragma is used?
What is parse method?
What is the static method?
When is the finalize() called?
Give a brief description of java socket programming?
How many types of assembly languages are there?
What is passing parameters in java?
Explain the differences between static and dynamic variables?