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 the difference between a synchronized method and a synchronized block?

1015


What is the original name of java?

1008


Does java support multiple inheritance or not?

1022


What is the difference between length and length() method in java?

1054


Explain an algorithm to find depth of a binary tree.

991


Explain the concept of hashtables?

1058


What is ‘is-a ‘ relationship in java?

972


What environment variables do I need to set on my machine in order to be able to run java programs?

961


What are different types of states exist for a thread?

961


How do you download stubs from Remote place?

1711


Can an integer be a string?

984


How do you pass by reference?

986


What is static import in java?

940


What is the final keyword?

935


What if I write static public void instead of public static void in java?

1026