System.out.print("Enter a Value: ");
val = s.nextInt();
This line is placed in last.The whole code is as follows:-
public static void main(String[] args){
int min, max;
Scanner s = new Scanner(System.in);
System.out.print("Enter a Value: ");
int val = s.nextInt();
min = max = val;
while (val != 0) {
if (val < min) {
min = val;
}
if (val > max) {
max = val;
}
System.out.print("Enter a Value: ");
val = s.nextInt();
}
System.out.println("Min: " + min);
System.out.println("Max: " + max);
}