I must be missing something:
public class Test {
public static void main(String[] args) {
(new Thread(new Action())).run();
System.out.println("Blah");
}
}
class Action implements Runnable {
public void run() {
while (true) {
}
}
}
I make a thread that is supposed to be running a loop.
In my main thread I print "Blah".
However, it is never printed. Why not? If I made a separate thread, it shouldn't affect my main execution thread, right?
This machine has four cores.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…