TCS NQT Previous Year Solve | Day 3 | Slot 1 (IV) | Codewindow.in
Programming Logic import java.util.*; public class Main { public static void main(String[] args) { ArrayListTempArrayList = new ArrayList(); TempArrayList.add(30); TempArrayList.add(20); TempArrayList.add(10); TempArrayList.add(40); TempArrayList.add(50); Collections.sort(TempArrayList, Collections.reverseOrder()); Collections.sort(TempArrayList, Collections.reverseOrder()); System.out.println(TempArrayList); } } Question 1 Answer Explanation Question 1 What will be the output of the above program? Answer [50, 40, 30, 20, 10] Explanation Collections.sort(TempArrayList, Collections.reverseOrder()) sorts […]
TCS NQT Previous Year Solve | Day 3 | Slot 1 (IV) | Codewindow.in Read More »