String Reverse in Java...!

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


Please Help Members By Posting Answers For Below Questions

What is time complexity java?

532


Explain the difference between call by refrence and call by value?

557


What are the four versions of java?

545


What are the types of relation?

565


How to store image in arraylist in java?

508






Difference between this() and super() ?

571


Can singleton class be cloned?

557


Why is java architectural neutral?

613


Why java is object oriented?

584


How to convert string to char and vice versa?

513


Explain abstract class in java?

556


Can final class have constructor?

497


What is prefix of a string?

569


Is singleton a bad practice?

575


What is an error in java?

637