我对java编程相当陌生,我想知道是否有某种方法可以用某种“超级”返回语句结束其父方法。
前任:
public class test {
public method1 () {
...some code...
if (someValue == someValue2) {return;}
...more code...
}
public static void main(String[] args) {
...some code...
method1();
...more code...
}
}
我希望 method1 的 return 语句也结束父方法的执行(在本例中为 main 方法)而不添加 if 语句,基于返回的值,在 method1 的调用之后。那可能吗?
谢谢!