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

How does j2ee application work?

561


What is a jbutton in java?

595


How do I run java?

548


Is java is fully object oriented?

613


Which java technology is in demand?

549






Why awt is used in java?

576


I’m new to WebLogic Does anyone knows how to Deploy Application using

1830


What are the modules of j2ee?

591


What is java servlet container?

574


Describe orm?

597


Is c++ more secure than java?

574


What is jaxr client?

584


Is java part of oracle?

549


What is frame in java?

589


What is the name of java compiler?

554