小编use*_*994的帖子

使用简单的布尔值时遇到麻烦

对不起,如果这是一个愚蠢的问题,但我完全是新的,只是尝试我的手.我的代码卡住....在此之后,程序结束,无论是选择1还是2.我知道它的一些简单的东西我不知道......任何输入都值得赞赏 我复制并粘贴了我认为问题所在的部分.

    System.out.println("Is this information correct? Enter 1 if it is correct, and 2 to change");
    Scanner inputCorrect = new Scanner(System.in);
    int pick = inputCorrect.nextInt();
    boolean isCorrect = false;

    while (isCorrect = false){

          while (!(pick == 1) && (!(pick ==2)))
              System.out.println("That is not a valid entry please try again");

              if (pick == 1){

                  isCorrect = true;
              }

              if (pick == 2){
                  System.out.println("Enter 1 to change your name, 2 to change your age or 3 to change your gender");
                  Scanner inputChange …
Run Code Online (Sandbox Code Playgroud)

java conditional boolean

0
推荐指数
1
解决办法
153
查看次数

标签 统计

boolean ×1

conditional ×1

java ×1