eclipse中的方法類型問(wèn)題
我在輸入public animal(){System.out.print("animal執(zhí)行了");}的時(shí)候 ?eclipse提示有錯(cuò)誤 ?錯(cuò)誤:return type of the method is missing 我想知道 哪里有錯(cuò)誤 ?
我在輸入public animal(){System.out.print("animal執(zhí)行了");}的時(shí)候 ?eclipse提示有錯(cuò)誤 ?錯(cuò)誤:return type of the method is missing 我想知道 哪里有錯(cuò)誤 ?
2016-01-03
舉報(bào)
2016-02-05
Animal,構(gòu)造方法與類同名
2016-01-03
按是否有返回值劃分,方法有兩種:
帶返回值:格式為:限定修飾符(private/public/protected/(不寫))+返回值類型 +方法名(){}
不帶返回值:格式為,限定修飾符(private/public/protected/(不寫))+void +方法名(){}
你的錯(cuò)誤屬于第二種,不帶返回值,忘了寫void!
2016-01-03
作為小白的我知道了 ? ?是構(gòu)造方法 ?在實(shí)例化中自動(dòng)調(diào)用
2016-01-03
能不能把你這個(gè)類截圖看看