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
which class is the wait() method defined in? : Java thread
Explain garbage collection in java?
Can you declare a private method as static?
Why hashcode is used in java?
What is a predicate method?
Does java arraylist maintain insertion order?
Does unicode support all languages?
What are the string methods in java?
Can we sort arraylist in java?
What does int argc char * argv [] mean?
What is a list in java?
What is a byte array?
Java Compiler is stored in JDK, JRE or JVM?
What is binary tree in java?
Tell me how many ways are there to initialise an integer with a constant.