Java 为什么我的代码可以在某些站点上运行,但不能在NetBeans中运行?

Java 为什么我的代码可以在某些站点上运行,但不能在NetBeans中运行?,java,netbeans,Java,Netbeans,我在Netbeans上编写这段代码,在线程“main”java.lang.RuntimeException:不可编译的源代码-不兼容的类型:int无法在第44行转换为布尔值 我在两个网站上编写了这段代码,运行起来没有问题,但在NetBeans上我得到了这个错误 我正试图得到这个输出 输入三个整数: 1 4 0 选择状态: 用户首选(1) 用户做出的第二选择(4) 选择数量=2 这个输出呢 输入三个整数: 7 5 7 选择状态: 用户首选(7) 用户做出的第二选择(5) 用户第三次选择(7) 选择

我在Netbeans上编写这段代码,在线程“main”java.lang.RuntimeException:不可编译的源代码-不兼容的类型:int无法在第44行转换为布尔值

我在两个网站上编写了这段代码,运行起来没有问题,但在NetBeans上我得到了这个错误

我正试图得到这个输出

输入三个整数: 1 4 0 选择状态: 用户首选(1) 用户做出的第二选择(4) 选择数量=2

这个输出呢

输入三个整数: 7 5 7 选择状态: 用户首选(7) 用户做出的第二选择(5) 用户第三次选择(7) 选择数量=3

import java.util.Scanner;

public class Main {
  public static void main(String[] args) {

System.out.println("Teacher's Copy");

Scanner input = new Scanner(System.in);

System.out.println("Enter three integers: ");
int firstchoice = input.nextInt();
int secondchoice = input.nextInt();
int thirdchoice = input.nextInt();


if (firstchoice == 0)
System.out.println("State of choices: \n" +
"no choices made yet");

else if (secondchoice == 0)
System.out.println("State of choices: \n" +
"user made firstchoice ( " +firstchoice + ") \n" + 
"number of choices = 1");

if (thirdchoice == 0)
System.out.println("State of choices: \n" + 
"user made firstchoice (" + firstchoice + ")\n" +
"user made secondchoice (" + secondchoice + ")\n" +
"number of choices = 2"); 

System.out.println("State of choices: \n" + 
"user made firstchoice (" + firstchoice + ")\n" +
"user made secondchoice (" + secondchoice + ")\n" +
"user made thirdchoice (" + thirdchoice + ")\n" +
"number of choices = 3");

  }


}


提前谢谢大家

您的代码绝对正确。可能,当您试图复制代码时,Netbeans会弄乱您上面示例中的哪一行代码是第44行?您以前是否编译过代码?我不使用Netbeans,但是Eclipse有
Project->Clean
选项来删除编译后的代码并强制重新编译,我假设Netbeans也有类似的选项,也许可以尝试一下。