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

CheckBox State

Java quiz · Question 59
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});