Listnames = new ArrayList<>(); names.add("John"); names.add("Mary"); names.add("Peter");
for(int i=0;i
3. Sorting a List of IntegersListThe java.util package is a standard Java library package that contains several classes and interfaces to support collections of objects, time and date manipulation, and resource management. The List interface is a part of this package, and it is widely used in Java programming.nums = new ArrayList<>(); nums.add(10); nums.add(5); nums.add(20); Collections.sort(nums);