gpt4 book ai didi

java - 程序未针对 Java 进行编译,我缺少什么

转载 作者:行者123 更新时间:2023-12-01 17:51:18 24 4
gpt4 key购买 nike

package freshjuice;


class FreshJuice {

enum FreshJuiceSize { SMALL, MEDIUM, LARGE }
FreshJuiceSize size;
}


}

public class FreshJuiceTest {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
FreshJuice juice = new FreshJuice();
juice.size = FreshJuice.FreshJuiceSize.MEDIUM ;
System.out.println("Size: " + juice.size);
// TODO code application logic here
}

}

这是我收到的错误消息:

Error: Main method not found in class freshjuice.FreshJuice, please define the main method as:
public static void main(String[] args)
or a JavaFX application class must extend javafx.application.Application
C:\Users\TheGODMasterDu\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 2 seconds)

最佳答案

您的文件必须名为 FreshJuiceTest.java,因为这是您的 main 方法所在的类。

关于java - 程序未针对 Java 进行编译,我缺少什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49842094/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com