為什么重新賦值運(yùn)行錯(cuò)誤
public class HelloWorld{
? ? public static void main(String[] args) {
String hobby="慕課網(wǎng)";
? ? ? ??
System.out.println(+hobby);
hobby="我愛慕課網(wǎng)":
System.out,println(+hobby)
}
}
顯示
error: not a statement
System.out,println(+hobby);
^
error: ';' expected
System.out,println(+hobby);
^
2 errors
2015-05-02
分號(hào)、引號(hào)切換成英文狀態(tài)下的吧,中文狀態(tài)的會(huì)報(bào)錯(cuò)。+一般在輸出語句中做連接符,單獨(dú)的變量或字符串是不需要+的。
參考代碼:
2015-05-02
你那個(gè) +hobby 什么意思?