I have the following Java code:
public static void main(String[] args)
{
new Thread(new MyRunnable()).run();
showGUI();
}
My problem is that starting MyRunnable blocks the main thread, causing showGUI to not be called until it finishes running. What I’d like the program to do is spawn MyRunnable and allow it to run independently in the background, enabling the main thread to forget about it and go ahead and do what it wants (like call showGUI).
runexecutes on the main thread.startwill create a new thread execution and execute it’s run method on that thread.