小编Jak*_*eba的帖子

跳过If语句

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 …
Run Code Online (Sandbox Code Playgroud)

java string

3
推荐指数
1
解决办法
291
查看次数

标签 统计

java ×1

string ×1