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...

Suppose there is an array list [10,5,20,19,15,24].Print them
in ascending & descending order in collection framework
concept ???

Answer Posted / abzy wabzy

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class MainClass {
public static void main(String[] a) {
List list = new ArrayList();
list.add("A");
list.add("C");
list.add("B");
Collections.sort(list);//for Ascending order
System.out.println(list);
Collections.sort(list, Collections.reverseOrder
());//for descending order
System.out.println(list);
}
}

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I stop concurrentmodificationexception?

1024


What is static class

1102


Why stringbuffer is faster than string?

1030


What is qualitative variable?

918


Can sleep() method causes another thread to sleep?

1035


Does java list allow null?

977


How many types of memory areas are allocated by jvm?

1032


What is a local, member and a class variable?

1033


What is collections framework?

1140


Describe method overriding

1121


What are the basic concepts of OOPS in java?

1025


What is the use of http-tunneling in rmi?

1040


What are the new features in java 8? Explain

945


What is immutable data?

1044


What is the difference between a choice and a list?

1075