CJCoding With Joseph
15per day
← Back to Question List

Select topics to narrow your question pool, then enable Random to jump to a random question matching your filters.

Topics:
Java Quiz #51

Background Thread UI Update

mediumJavaFX

This code throws an IllegalStateException at runtime. What is the issue?

📄 Code

1Label status = new Label("Loading...");
2 
3new Thread(() -> {
4 try { Thread.sleep(2000); } catch (Exception ex) {}
5 status.setText("Done!");
6}).start();