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

which class is the wait() method defined in? : Java thread

946


Explain garbage collection in java?

984


Can you declare a private method as static?

1154


Why hashcode is used in java?

973


What is a predicate method?

1018


Does java arraylist maintain insertion order?

999


Does unicode support all languages?

1033


What are the string methods in java?

1097


Can we sort arraylist in java?

995


What does int argc char * argv [] mean?

997


What is a list in java?

946


What is a byte array?

1101


Java Compiler is stored in JDK, JRE or JVM?

1522


What is binary tree in java?

1059


Tell me how many ways are there to initialise an integer with a constant.

1110