We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
重载和重写的区别 此处提及
重载 发生在同一个类中,方法名必须相同,参数类型不同、个数不同、顺序不同,方法返回值和访问修饰符可以不同。
重载
发生在同一个类中,方法名必须相同,参数类型不同、个数不同、顺序不同,方法返回值和访问修饰符可以不同。
但是返回值和访问限制符号不同好像会报错。
public class HelloWorld { public void testFoo(){ } public String testFoo() { return ""; } }
报错:Duplicate method testFoo() in type HelloWorld
The text was updated successfully, but these errors were encountered:
返回值不同不能叫重载
Sorry, something went wrong.
No branches or pull requests
重载和重写的区别
此处提及
但是返回值和访问限制符号不同好像会报错。
报错:Duplicate method testFoo() in type HelloWorld
The text was updated successfully, but these errors were encountered: