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
Differentiate between the constructors and methods in java?
What is the difference between Java and C++?
What are class members by default?
What is math exp in java?
how to open and edit XML file in Weblogic???
What is the difference between form & report?
Difference between static and dynamic class loading.
Define interface in java?
Does treeset use compareto?
How many bytes is double?
What is meant by structural programming?
What is difference between ++ I and I ++ in java?
Define immutable object?
How do you create a bulleted list?
What are instance variables?