String Word Reverse without Reverse Function

11 08 2014

we have the string = Java programming is fun and we want to reverse that string in each word wise

avaJ gnimmargorp si nuf ,without using any reverse function.

* @author TechSivam
* Reverse the string each word and not to use any string reverse methods.
public class StringReverse {
public static void main(String[] args) {
StringBuffer a = new StringBuffer(“Java programming is fun”);

String[] s=a.toString().split(” “);

for (String string : s) {

for (int i = string.length()-1; i >=0; i–) {
System.out.print(” “);






Java programming is fun
avaJgnimmargorp si nuf



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: