Overload(重载)和Override(重写)有点分不清,下面的程序哪个方法是重载,哪个是重写啊?- class MyFather{
-
- public int meth(int a ){
- a= 1;
- return a;
- }
- }
- class MySon extends MyFather{
- //A
- public int meth(int b){
- b = 2;
- return b;
- }
-
- //B
- private int meth(){
- return 2;
- }
-
- //C
- public void meth(int c ,int d){
-
- }
- }
复制代码
|
|