Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

String Reverse in Java...!

Answer Posted / anjani kumar jha

import java.util.*;

public class StringReverseWord {

private static void doStringReverseWord() {

String a = "Anjani ...................Kumar Jha";
Stack stack = new Stack();

// this statement will break the string into the
words which are separated by space.
StringTokenizer tempStringTokenizer = new
StringTokenizer(a);

// push all the words to the stack one by one
while (tempStringTokenizer.hasMoreTokens()) {
stack.push(tempStringTokenizer.nextElement());
}

System.out.println("\nOriginal string: " + a);

System.out.print("Reverse string: ");

//pop the words from the stack
while(!stack.empty()) {
System.out.print(stack.pop());
System.out.print(" ");
}
System.out.println("\n");
}
public static void main(String[] args) {
doStringReverseWord();

}

}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are loops in java? What are three types of loops?

982


What is Java Shutdown Hook?

1115


What is ide with example?

909


What is fail first in java?

1078


Is string an object?

1060


What is the purpose of using javap?

1027


What are the differences between Java 1.0 and Java 2.0?

2201


what is daemon thread and which method is used to create the daemon thread? : Java thread

905


Why singleton class is used in java?

1075


Can java arraylist hold different types?

990


Why is it called boolean?

940


What is bool mean?

1003


Write a program in java to establish a connection between client and server?

925


What is the purpose of declaring a variable as final?

914


What is purpose of applet programming?

1134