write a program, when a statement is entered, it should
display in reverse order.
Ex: Statement is "I am writing program in reverse order".
Output should be like "order reverse in program writing am I".

Answer Posted / vishal

public class Reverse {
public static void main(String[] args) {
String sentence="I am writing program in reverse order";
String[] temp=sentence.split(" ");
for(int i=temp.length-1;i>=0;i--){
System.out.print(temp[i]+" ");
}
}
}

Is This Answer Correct ?    16 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is conversational state?

713


What is context root?

726


What are the four components of j2ee application?

757


What is a component in java?

640


What are the four types of J2EE modules?

773


What is j2ee stand for?

657


Is java is fully object oriented?

716


What are the main components of multi-tier architecture?

683


to update a batch in a table in jdbc which method of statement object is used

1851


What is event in java?

638


What is the difference between java and j2ee?

623


What is Connector architecture?

704


What is sandbox in java?

684


What is the best java course?

709


Why java is called portable language?

673