import java.util.Scanner;
public class Questionaire {
public static void main(String[] args) {
String name;
String ansOne;
Scanner input = new Scanner(System.in);
System.out.print("Hello, welcome to the super awesome quiz. Let's get things going. What is your name?");
name = input.nextLine();
System.out.print("Okay, hi " + name + " I'm just going to call you Bob.");
System.out.print(" Question 1: What is the name of your dog?");
ansOne = input.nextLine();
if (ansOne == "Avagantamos") {
System.out.print("Correct!");
} else {
System.out.print("Wrong! The correct answer was Avagantamos!");
}
}
}
所以基本上,当它要求你输入你的狗的名字时,即使你输入Avagantamos也是不正确的。我仍然非常喜欢,这真是令人沮丧,所以非常感谢任何回应的人。跳过如果语句
欢迎来到SO。 +1提供所有必要的细节以供某人回答您的问题(您会惊讶多久不是这种情况)。输入代码时,请尝试正确格式化,并缩进整个块4个空格,以便SO将使用固定宽度的字体显示它。在输入页面上有一个按钮“{}”,它将缩进所选的4个空格。安德鲁为你做了这件事。 – 2012-03-27 01:10:48