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

Explain about class in java?

1054


What is a char in java?

991


what is a green thread? : Java thread

960


What is the file type?

969


What is considered an anti pattern?

881


what is meant wrapper classes?

1109


When is the arraystoreexception thrown?

971


Can we extend private class in java?

932


Do you know why doesn't the java library use a randomized version of quicksort?

913


What is a 16 bit word?

950


What is meant by string is immutable?

1011


How can you add and remove nodes in jtree?

983


What is volatile data type?

955


Can we define a package statement after the import statement in java?

1024


What is public/private protected in java?

1003