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
What is the function of static in java?
How do you check if two given string are anagrams?
What is difference between next () and nextline () in java?
How to retrieve data from database in java using arraylist?
What are the 3 types of control structures?
What is byte value?
What mechanism does java use for memory management?
What is a static class in java?
Write a factorial program using recursion in java?
What are data types in programming?
What is skeleton and stub?
Explain the scope of a variable.
What is the main purpose of serialization in java?
What is the relationship between class and object?
What are the differences between c++ and java?