看板 java 關於我們 聯絡資訊
書本的範例,我有省略程式碼 我把塗色的「super.」拿掉 run起來也是一樣結果 那麼為什麼範例要加super.呢? thanks class MyJFrame extends JFrame { ImageIcon[] icons = new ImageIcon[5]; JButton[] jbtn = new JButton[8]; MyJFrame() { super.setLayout(null); super.setTitle("Test"); (略) setSize(430, 360); setVisible(true); } } public class Main { public static void main(String[] args) { new MyJFrame(); } } -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.163.106.192 ※ 文章網址: http://www.ptt.cc/bbs/java/M.1406270200.A.572.html
ssccg:大概是要讓你清楚那是JFrame的方法 07/25 14:38
yyc1217:如果MyJFrame有同樣名稱的method會被呼叫,沒有沒差 07/25 15:26
※ 編輯: dharma (118.163.106.192), 07/26/2014 12:40:42