Write a java program to get a string of words and print the numbers of each word count in descending order
Answer Posted / prash
class WordCount{
public List list;
public static void main(String[] args) {
System.out.println(args[0]);
List arr = Arrays.asList(args);
Iterator it = arr.iterator();
List l = new ArrayList();
while (it.hasNext()) {
String s = (String) it.next();
System.out.println(s);
l.add(s.length());
}
Collections.sort(l);
Collections.reverse(l);
}
}
| Is This Answer Correct ? | 8 Yes | 10 No |
Post New Answer View All Answers
How do you compare values in java?
What is the formula to calculate percentage?
Why there are some null interface in java? What does it mean?
Explain the concept of hashtables?
What are register variables what are the advantages?
What are 3 boolean operators?
What happens when a thrown exception is not handled?
What are 3 data types?
Can a class have more than one object?
What is the main use of generics in java?
Can a hashset contain duplicates java?
What do you understand by final value?
What is communist flag?
Is a case study a method or methodology?
What is javac_g?