abstract ? ?class ? AbsDemo{ abstract ? void ? show();}? class ? Test{ ?static ? class ? Inner ? implements ? Inter ?{ ?public ?void ? method() ?{ ?System.out.println("method ? run"); ?} ?} ???? public ? void ? function()? { ?AbsDemo ? d=new ? AbsDemo() ?{ ?int ?num=9; ?void ?show() ?{ ?System.out.println("num==="+num); ?} ?void ? abc() ?{ ?System.out.println("haha"); ?} ?}; ?d.show();? }? } ?class ? InnerClassTest ?{ ?public ?static ?void ?main(String[] ? args) ?{ ?Test.function().method(); ?} ?} ?報錯信息說Test.function().method();無法從靜態上下文中引用非靜態方法function()
3 回答


按照自己的節奏前行
TA貢獻90條經驗 獲得超70個贊
隨便看了一眼,兄弟,abstract ? ?class ? AbsDemo抽象類無法創建對象你不知道嗎?能不能先把java基礎打牢?唉,著急學有個屁用!
添加回答
舉報
0/150
提交
取消