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