class zhidao {
int max, min, in;
Scanner sc = null;
public zhidao() {
max = Integer.MIN_VALUE;
min = Integer.MAX_VALUE;
in = 0;
sc = new Scanner(System.in);
do input();
while(in != 0);
System.out.print("最大值是: " + max + " 最小值是: " + min);
sc.close();
}
public void input() {
System.out.print("请输入一个整数(输入0结束): ");
in = sc.nextInt();
if(in != 0) {
max = max > in ? max : in;
min = min < in ? min : in;
}
}
public static void main ( String args[] )
{
new zhidao();
}
}