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 maximum size of list in java?
Explain access modifiers in java.
What is the different types of functions?
What are the methods to rectify ambiguities in the interfaces in JAVA?
What is array length?
Can you change array size in java?
Why do we need wrapper class?
Can array grow dynamically in java?
What is an infinite loop? How infinite loop is declared?
What is the difference between a scrollbar and a scrollpane?
How do you convert int to char in java?
What are the differences between this and super keyword?
Mention some features of java?
What methods are used to get and set the text label displayed by a button object?
Differences between external iteration and internal iteration?