Top of the technical interview question in IT companies.This question generally for 1-3 years experience java or android developers.  Here is question understating.

String input = “Eyehunt website java”;

String output = “java website Eyehunt”;

There is several way to solve this problem :

1. Using split method and convert string into array then arrange reverse order of string using for loop

Sometime interviewer ask for reverse sentence without suing split method. In that condition we can use ArrayList() data structure.If you don’t know Arraylist then follow this ArrayList tutotrial…

2. Another example of reversing sentence

 

 

Leave a Reply