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...

Write a java program to get a string of words and print the numbers of each word count in descending order

Answer Posted / ruchira

import java.util.StringTokenizer;

public class NumberOfWords {

/**
* to get a string of words and print the numbers of
each word count in descending order

*/
public static void main(String[] args) {
String str = "Save water";

System.out.println(str);
StringTokenizer st = new
StringTokenizer(str," ");
int i = 0;
i=st.countTokens();
while (i>0)
{
System.out.println(i);
i --;
}
}
}

Is This Answer Correct ?    12 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is method overloading not possible by changing the return type in java?

1005


Enlist few advantages of inheritance?

1074


What is an example of declaration?

1006


What are some characteristics of interference class?

996


What is the method to expand and collapse nodes in a jtree?

1042


What are static blocks in java ?

1108


os is developed in c no java is more secured then c na why dont the os developed is developed using java

4229


What is class forname?

1022


How we can make copy of a java object?

1100


What are the new features in java 8?

1020


Name the components that are termed to be Heavy-weight component but available in Light-weight components?

2491


Can a class have a static inner class?

1083


What types of index data structures can you have in java?

1234


What is the concept of multithreading?

991


What is anagram of a string?

947