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

public class WordCount {

private String word;
private Long wordCount;

public WordCount(String word) {
this.word = word;
}

public void displayWordCount() {
String[] temp = word.split(" ");
for (int index = temp.length - 1; index >= 0; index--) {
System.out.println(temp[index] + "-->" +
temp[index].length());
}
}

public static void main(String args[]) {
WordCount wordCount = new WordCount("I Will Crack
This");
wordCount.displayWordCount();
}

}

Is This Answer Correct ?    12 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which graphs are functions?

1015


How do you input a string in java?

1147


What is a line break?

1078


how to create constants in java?

1129


How do you sort arrays in java?

990


Is set sorted in java?

992


List types of storage classes in java?

1222


How arrays are stored in memory in java?

1023


What is finally in Java?

1132


If goto and const is reserve words than why it is not work in java?

2026


How much ram can a 64 bit processor theoretically?

964


Give few difference between constructor and method?

1025


Why vector is used in java?

1071


What are the types of literals?

1268


What is the exact difference in between Unicast and Multicast object? Where will it be used?

1107