Hi.

I'm trying to find the largest and the second largest number in vector. But I can't.

Can you help?

Error message:public class Minmax{ public static void main(String[] args) { //int min = Integer.MIN_VALUE; int max = Integer.MAX_VALUE; int max2 =Integer.MAX_VALUE; while (!StdIn.isEmpty()) { int N = StdIn.readInt(); if (N > max){ max2=max;//storing the old max max = N;//the new max } else if (N>max2 && N<max) {//if the number is between new max and the old max max2=N; } } StdOut.println(max2 + " " + max); } }

C:\>java Minmax 2 22 5 55 6 66

^Z

2147483647 2147483647

C:\Users>java Minmax

55 2 66 2 88 5 99

^Z

2147483647 2147483647