CJCoding With Joseph
15free / daySign inCreate account
Back to Multiple Choice Quiz

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

Topics

Background Thread UI Update

Java quiz · Question 51
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();