gpt4 book ai didi

java - 命名变量 "goto"时出现神秘错误?

转载 作者:行者123 更新时间:2023-11-29 09:34:00 25 4
gpt4 key购买 nike

<分区>

我尝试编写一些简单的代码来连接两个字符串并打印它们:

class A {
public static void main(String[] args) {
String goto = "jon skeet";
System.out.println("the go-to guy for java questions is " + goto);
}
}

但是它得到了所有这些错误:

$ javac A.java && java A
A.java:3: not a statement
String goto = "jon skeet";
^
A.java:3: ';' expected
String goto = "jon skeet";
^
A.java:4: illegal start of expression
System.out.println("the go-to guy for java questions is " + goto);
^
A.java:4: ';' expected
System.out.println("the go-to guy for java questions is " + goto);
^
4 errors

为什么?

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