請教這是錯哪了?。慷际怯⑽淖址斎?啊
public class HelloWorld {
? ? public static void main(String[] args) {
? ? ? ? int=25;
? ? ? ? if (age>=18) {
? ? ? ? ? ? System.out.println("成年");? ? ?
? ? ? ? }else{
? ? ? ? ? ? System.out.println("未成年");
? ? ? ? ? ? ? ? }
? ? }
}
2021-03-12
定義一個變量的格式是: ?數據類型????變量名=????參數;
如定義一個名為xxx的字符串變量,給xxx賦值為張三豐, 如下:
例如????String????????xxx=????"張三豐";
String 是數據類型
xxx????是變量名
張三豐????是參數
你的????int????是整數類型????????????????好比????整數類型是參數,一聽就不對。
2021-02-25
你int后邊沒定義變量名稱,電腦不知道age是啥
2021-02-25
public?class?HelloWorld?{ ????public?static?void?main(String[]?args)?{ ???? int?age=25; ????????????if(age?>=?25){ ???????? ???? ????System.out.println("成年了"); ???? }else{ ??? ???? ????System.out.println("未成年"); ???? }?? ????} }你看下這個
2021-02-25
class?HelloWorld?{ ????public?static?void?main(String[]?args)?{? ???????????int=25;???????? ???????????if?(age>=18)?{ ???????????????????????System.out.println("成年"); ???????????}else{???????????? ???????????System.out.println("未成年");???????????????? ???????????}???? ????} }第一行多了個public?