happens befor 原则?

public class T extends Thread {

@Override
public void run() {
System.out.println("a");
throw new RuntimeException("runtionException");
}

public static void main(String[] args) {
new T().start();
System.out.println("b");
}

}

执行结果是什么情况?

1:

b
a
Exception in thread "Thread-0" java.lang.RuntimeException: runtionException
at T.run(T.java:7)

2:

Exception in thread "Thread-0" java.lang.RuntimeException: runtionException
at T.run(T.java:6)
a
b
3:

b
Exception in thread "Thread-0" java.lang.RuntimeException: runtionException
at T.run(T.java:6)
a
4:

Exception in thread "Thread-0" b
a
java.lang.RuntimeException: runtionException
at T.run(T.java:6)
5:

Exception in thread "Thread-0" java.lang.RuntimeException: runtionException
at T.run(T.java:6)
b
a

 

 

你可能感兴趣的:(APP)