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 are the different tags provided in jstl?
What are synchronized methods ?
What is an eror in java?
What is an object in java?
What are the topics in advance java?
How do you read a char in java?
What about instanceof operator in java?
What is the argument in java?
What is the main advantage of passing argument by reference?
What is collections framework?
Are arrays immutable in java?
What is return used for in java?
What is compareto?
What is return null in java?
Why is java so popular?