Skip to content
New issue

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

重写时异常问题 #939

Closed
mahorse-2016 opened this issue Sep 21, 2020 · 0 comments
Closed

重写时异常问题 #939

mahorse-2016 opened this issue Sep 21, 2020 · 0 comments

Comments

@mahorse-2016
Copy link

@mahorse-2016 mahorse-2016 commented Sep 21, 2020

重写时,如果子类方法抛出的异常是运行时异常,父类方法可以不抛异常。

public class SuperClass{
public void test(){

}

}

class ChildClass extends SuperClass{

@Override
public void test() throws NullPointerException{

}

}

@Snailclimb Snailclimb closed this Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants