Computer Science, asked by Mister360, 3 months ago

How to find second largest number in an array?

Language = Java

Answers

Answered by aditikanwadkar
1

Answer:

1]import java.util.*;

2]public class SecondLargestInArrayExample2{

3]public static int getSecondLargest(Integer[] a, int total){

4]List<Integer> list=Arrays.asList(a);

5]Collections.sort(list);

6]int element=list.get(total-2);

7]return element;

8]   }

Mark me Brainliest!!

: )

Similar questions