import java.util.Scanner;
public class Exam {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
double[] x = new double[2];
int n = 0;
do {
System.out.print("Enter a number (-ve to finish): ");
x[n] = input.nextDouble();
if (x[n] >= 0) {
n++;
}
System.out.println("n=" + n);
} while ((n < 2) && (x[n] <= 0));
}
}
我想問e條code 點解我 入1 佢仲會繼續run 而唔會直接出output??
我while 條件 ((n < 2) && (x[n] <= 0)); 我入1 唔係應該即出??