-2
出於某種原因,我的鍵盤在提示時不會輸入任何內容。這裏是我的代碼:keyboard.next無法接收輸入
import java.util.Scanner;
public class ForgetfulMachine {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
System.out.println("What city is the capital of France?");
keyboard.next();
System.out.println("What is 6 multiplied by 7?");
keyboard.nextInt();
System.out.println("Enter a number between 0.0 and 1.0");
keyboard.nextDouble();
System.out.println("Is there anything else you would like to say?");
keyboard.next();
}
}
那你試着寫控制檯? – Tom
您沒有使用'keyboard.next()'返回的值' –
您是否試圖獲取您正在輸入的值?因爲你的代碼接受任何東西,只是在 –