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 #59

CheckBox State

easyJavaFX

What does this code print when the user checks the box?

📄 Code

1CheckBox agree = new CheckBox("I agree to the terms");
2Label result = new Label();
3 
4agree.setOnAction(e -> {
5 if (agree.isSelected()) {
6 result.setText("Accepted");
7 } else {
8 result.setText("Not accepted");
9 }
10});