Find Second Largest Number in Array

Find Second Largest Number in Array

Here, you will know to find second largest number in array java program. We will do this program by using two different ways.

1. With Sorting Array method

2. Without Sorting Array method

The number that has the second highest value in a set of numbers, is called the second largest number. For Example, array list {3, 7, 8, 12, 15,17,20}, have 17 as second largest number.

Find Second Largest Number in Array

Output

Find Second Largest Number in Array java program output

 

Find Second Largest Number in Array without Sorting

Output

C:\CodeRevise\java>javac SecondLargestWtSort.java

C:\CodeRevise\java>java SecondLargestWtSort
Enter number of elements : 6
Enter elements of array : 3
5
2
9
7
4
Second largest number : 7

 

 

Check out our other Java Programming Examples

 

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top