← Back to Question List
Java Quiz #51
Background Thread UI Update
This 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();