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
How to sort double array in java?
How do you start a new line in java?
Can private members of a base class are inheritable justify?
What is arraylist class in java?
What are the restrictions imposed by a Security Manager on Applets?.
What are synchronized blocks in java?
What about anonymous inner classes in java?
What is pre increment and post increment in java?
Give few difference between constructor and method?
What are the types of methods in java?
Where is the singleton class used?
What classes of exceptions may be caught by a catch clause in java programming?
Which object oriented concept is achieved by using overloading and overriding?
Define how objects are stored in java?
Can the garbage collection be forced by any means?