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 are the different tags provided in jstl?

913


What are synchronized methods ?

1046


What is an eror in java?

988


What is an object in java?

971


What are the topics in advance java?

910


How do you read a char in java?

948


What about instanceof operator in java?

964


What is the argument in java?

868


What is the main advantage of passing argument by reference?

909


What is collections framework?

1100


Are arrays immutable in java?

1003


What is return used for in java?

973


What is compareto?

968


What is return null in java?

899


Why is java so popular?

1054