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 nested class in java?

1165


What is a dot notation?

1025


How is a variable stored in memory?

996


Why is a string immutable?

994


Is integer immutable in java?

978


What is the applet security manager, and what does it provide?

993


What is javac used for?

936


What is meant by anonymous class?

1018


Break statement can be used as labels in java?

996


Can we create object of inner class in java?

943


Where and how can you use a private constructor?

983


How would you dynamically allocate memory to an array?

1035


What is the difference between array list and vector in java?

932


What is size_t?

978


Is intellij better than eclipse?

1081