Opening Hours :7AM to 9PM
import java.util.Arrays; class ThirdLargest { public int findThirdLargest(int[] arr, int n) { // sort the array Arrays.sort(arr); // return the element at index n-3 return arr[n - 3]; } } public class Main { public static void main(String[] args) { ThirdLargest tl=new ThirdLargest(); int[] arr = {1, 14, 2, 16, 10, 20, 5}; int n = arr.length; int thirdLargest = tl.findThirdLargest(arr, n); System.out.println("Third largest element is " + thirdLargest); } }The above program creates an array arr of integers and assigns it some values. It then defines a variable n that holds the length of the array.