很抱歉打扰大家,但我似乎无法在这里找到问题。仍在学习,所以任何输入都会很棒。
import java.util.Scanner;
public class AllAboutMe {
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
String name;
Boolean married;
int age, height;
System.out.print("What is your name? ");
name = keyboard.nextLine();
System.out.println("What is your age?");
age = keyboard.nextInt();
System.out.println("What is your height? ");
height = keyboard.nextInt();
System.out.println("Are you married?");
married = keyboard.nextBoolean();
char aChar = name.charAt(0);
System.out.println("Your name is " + name);
System.out.println("your initial is " + aChar);
System.out.println("Your marital status is " + married);
System.out.println("Your height is " + height);
System.out.println("Your age is " + age);
}
}
现在的主要问题是,当我运行它时它不起作用。我一直在寻找,我所看到的是我需要测试布尔值。这是真的?其他一切正常,但布尔选项不允许我输出。