gpt4 book ai didi

JAVA错误调试。

转载 作者:行者123 更新时间:2023-12-02 03:11:14 24 4
gpt4 key购买 nike

我是 Stack 社区的新手,正在尝试学习 JAVA。这是我在下面编写的第一行代码。编译时,我在输出中收到错误。请参阅代码下方的错误。

 Class FirstExample 
{
public static void main(String[] args)
{
System.out.println("Hello World, I love you!");
}

}
<小时/>
FirstExample.java:1: error: class, interface, or enum expected
Class FirstExample
^
FirstExample.java:3: error: class, interface, or enum expected
public static void main(String[] args)
^
FirstExample.java:6: error: class, interface, or enum expected
}
^
3 errors
<小时/>

如有任何帮助,我们将不胜感激。

最佳答案

你需要用小写来声明类,例如:

class FirstExample 
{
public static void main(String[] args)
{
System.out.println("Hello World, I love you!");
}

}

您可以在这里查看一些教程:https://docs.oracle.com/javase/tutorial/

关于JAVA错误调试。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41005473/

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