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
What is the difference between break and continue statements?
why Java does not support multiple inheritances?
What is nullpointerexception?
Explain the inheritance?
Where we write javascript code in html page?
If I only change the return type, does the method become overloaded?
What are the types of sockets in java?
How to compare strings in java?
What is the structure of java?
What does split function do in java?
How do you use compareto in java?
What are methods and how are they defined?
What are the java ide's? Explain
How do I get the | symbol on my keyboard?
Can java program run without jre?