Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is module in project?

903


What are the application of stack?

871


In a container there are 5 components. I want to display the all the components names, how will you do that one?

1003


What are use cases?

915


What are the different collection views provided by maps?

943


Difference between default and protected access specifiers?

1039


What do you mean by default constructor in java?

1022


How does the garbage collector works in java?

1050


Is 0 a prime number?

936


What are exception handling keywords in java?

983


what is the purpose of the runtime class?

1019


What is java virtual machine and how it is considered in context of java’s platform independent feature?

1116


Is math class static in java?

1056


What is the maximum size of arraylist in java?

954


What class allows you to read objects directly from a stream in java programming?

1001