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 are the access modifiers available in java?
How concurrent hashmap works?
What is method with example?
Differentiate between a constructor and a method? Can we mark constructors final?
What is currentthread()?
Write a program to find the greatest of three numbers in java?
does java support pointers?
What is a line break example?
What is the purpose of encapsulation?
Q1.A. Write note on “The class path Environment Variable”? B. Which are different kinds of source code? Q2.A. How to create an interface? B. Why convert an applet to an application? Q3.A. How to use Media tracker Class. B. How to use string tokenizer class. Q4 A. Explain the overview of UDP messaging. B. Difference between SQL Exception class and SQL Warning class. Q5. A. How to create com object in Java? B. Write short notes on “The properties class” Q6. A. When object is created and destroyed? B. Explain the JDB in depth & command line. C. Write short notes on Web Sites.
Differences between external iteration and internal iteration?
Can I extend singleton class in java?
Do I need java on my computer?
Can we pass null as argument in java?
Can we make a constructor final?