Finding largest number in java
Here’s a short and simple Java program to find the second largest element in an array in just a few lines public class SecondLargest { public static void main(String[] args) { int[] arr = {10, 5, 20, 8, 15}; int max = Integer.MIN_VALUE, secondMax = Integer.MIN_VALUE; for (int num : arr) { if […]