我对java编码相当陌生,但错误是如果我输入正确答案或错误答案,它仍然会同时显示正确和错误。
import java.util.Scanner;
public class MathTest {
public static void main(String[] args) {
Scanner user_input = new Scanner(System.in);
System.out.println("What is 5 times 4? ");
String question;
question = user_input.next();
if (question.equals(20));
System.out.println("Correct!");
if (!"20".equals(question));
System.out.println("Incorrect!");
}
}