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 / surya

public class WordCount {

public static void main(String[] args) {
String string="I got a simple solution";
String[] temp=string.split(" ");
for (int i = temp.length-1; i >=0 ; i--) {
System.out.println(temp[i]+ "-->"+temp[i].length());
}
}
}

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the maximum size of list in java?

1013


Explain access modifiers in java.

1100


What is the different types of functions?

1096


What are the methods to rectify ambiguities in the interfaces in JAVA?

1150


What is array length?

1015


Can you change array size in java?

1008


Why do we need wrapper class?

1037


Can array grow dynamically in java?

1024


What is an infinite loop? How infinite loop is declared?

1166


What is the difference between a scrollbar and a scrollpane?

1110


How do you convert int to char in java?

1117


What are the differences between this and super keyword?

983


Mention some features of java?

1005


What methods are used to get and set the text label displayed by a button object?

1066


Differences between external iteration and internal iteration?

1210