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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / sagar

Use
Collections.sort(arraylist)

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is the root class for all Java classes?

8 Answers   IBM, Infosys,


What is an event?

2 Answers  


What is the difference between JVM and JRE?

0 Answers  


How do you differentiate abstract class from interface?

0 Answers  


5 Coding best practices you learned in java?

0 Answers  


What are desktop procedures?

0 Answers  


Describe inheritance as applied to java?

4 Answers  


Variable of the boolean type is automatically initialized as?

0 Answers  


make a method which any number and any type of argument and print sum of that arguments.....

0 Answers  


there are N number of matchboxes numbered 1...N.each matchbox contain various number of stick.Two player can alternatevely pick some amount of stick from the higest stick containing box . The player is condidered win if there is no stick after his move.Find the final move so that the move player win. Note:In case the number of stick is equal ,pick the stick from the higest numbered box.

0 Answers   Manhattan,


What is the use of beaninfo?

0 Answers  


Mention some features of java?

0 Answers  


Categories