java中有返回值的函数中throw new exception会给函数返回值吗?返回值是什么?
天蓬老师
天蓬老师 2017-04-18 10:50:00
0
5
652

java中有返回值的函数中throw new exception会给函数返回值吗?返回值是什么?

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(5)
阿神

Exceptions will be thrown up one level at a time, with no return value.

PHPzhong

One method’s exit is return, and the other is to throw an exception. When an exception is thrown, there is no return value

迷茫

throw new RuntimeException(msg);
Use try catch to catch exceptions
e.getMessage();

左手右手慢动作

Throw an exception. The code that calls this method will either catch the exception or continue to throw the exception to the upper caller. There is no chance for you to receive the return value

左手右手慢动作

It depends on the situation. Runtime exceptions will not cause the program to interrupt, and will continue to execute, then there will be a return value. Non-runtime exceptions will directly interrupt the program, so there is no return value. If you respond to exceptions It doesn’t exist if it’s not captured

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!