Home » Java Program to find Second Smallest Number in an Array

Java Program to find Second Smallest Number in an Array

by Online Tutorials Library

Java Program to find Second Smallest Number in an Array

We can find the second smallest number in an array in java by sorting the array and returning the 2nd element. Let’s see the full example to find the second smallest number in java array.

Test it Now

Output:

Second smallest: 2 Second smallest: 33 

Find 2nd Smallest Number in Array using Arrays

Let's see another example to get second smallest element or number in java array using Arrays.

Test it Now

Output:

Second smallest: 2 Second smallest: 33 

Find 2nd Smallest Number in Array using Collections

Let's see another example to get second smallest number in java array using collections.

Test it Now

Output:

Second smallest: 2 Second smallest: 33 
Next TopicJava Programs

You may also like