官方文档
方法重载
In the Java programming language, you can use the same name for all the drawing methods but pass a different argument list to each method. Thus, the data drawing class might declare four methods named draw, each of which has a different parameter list.
Overloaded methods are differentiated by the number and the type of the arguments passed into the method.
在一个类中,方法重载指的是:
- 方法名相同
- 方法参数个数不同
- 方法参数类型不同
The compiler does not consider return type when differentiating methods, so you cannot declare two methods with the same signature even if they have a different return type.
方法返回参数不同,不属于方法重载,编译器会编译出错
来源:CSDN
作者:thebigdipperbdx
链接:https://blog.csdn.net/thebigdipperbdx/article/details/103603880