Write a program to second largest number in java ?
package javatute; public class SecondHighestNumberInJava { public void secondHighest(int [] number) { int secondlargestest = 0, largest = 0; for (int i = 0; i < number.length; i++) { if (largest < number[i]) { secondlargestest = largest; largest = number[i]; } if (secondlargestest < number[i] && largest != number[i]) secondlargestest = number[i]; } System.out.println("Second largest number is: " + secondlargestest); } public static void main(String[] args) { int number[] = {2,7,9,78,34,27}; SecondHighestNumberInJava secHighestNumberInJava = new SecondHighestNumberInJava(); secHighestNumberInJava.secondHighest(number); } }