Back to Multiple Choice Quiz
Background Thread UI Update
Java quiz · Question 51This code throws an IllegalStateException at runtime. What is the issue?
Code
1Label status = new Label("Loading...");23new Thread(() -> {4 try { Thread.sleep(2000); } catch (Exception ex) {}5 status.setText("Done!");6}).start();