我在尝试在 NetBeans 中运行 Java 程序时遇到问题。我收到以下错误:
Exception in thread "main" java.lang.RuntimeException: Uncompilable code - unexpected type
required: value
found: class
at pemrogramanjavaa.Ifelsejava.main(Ifelsejava.java:1)
C:\Users\user\AppData\Local\NetBeans\Cache\16\executor-snippets\run.xml:111: The following error occurred while executing this line:
C:\Users\user\AppData\Local\NetBeans\Cache\16\executor-snippets\run.xml:68: Java returned: 1
BUILD FAILED (total time: 3 seconds)
这是导致错误的代码:
public class Ifelsejava {
public static void main(String[] args) {
// Your code here
}
}
我认为您可能输入了错误的代码。因为主代码里什么都没有。但假设 main 中有正确的代码,可能类名和文件名不匹配。