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 nan false?
When can an object reference be cast to an interface reference in java programming?
what is the purpose of the runtime class?
Can we return null in java?
Why is static used?
What is break and continue statement?
When a lot of changes are required in data, which one should be a preference to be used? String or stringbuffer?
What is parsing in grammar?
What is serialization in java?
How does finally block differ from finalize() method?
Explain notifyall() method of object class ?
What is package private scope in java?
What is the difference between declaration and definition in java?
What are advantages of using Java?s layout managers than windowing systems?
What is meant by method overriding?