Overloading就是多載、超載的意思

簡單來說就是同一個名稱的method可以有很多個

但是要注意一個原則

method內的參數個數或是型態要不一樣

在使用時則會按照引數的型態來呼叫對應的method

 

1. 官網https://docs.oracle.com/javase/tutorial/java/javaOO/methods.html

01.png

 

2. 範例如下

02.png  

arrow
arrow

    RX1226 發表在 痞客邦 留言(0) 人氣()