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
Explain about class in java?
What is a char in java?
what is a green thread? : Java thread
What is the file type?
What is considered an anti pattern?
what is meant wrapper classes?
When is the arraystoreexception thrown?
Can we extend private class in java?
Do you know why doesn't the java library use a randomized version of quicksort?
What is a 16 bit word?
What is meant by string is immutable?
How can you add and remove nodes in jtree?
What is volatile data type?
Can we define a package statement after the import statement in java?
What is public/private protected in java?