Back to Multiple Choice Quiz
CheckBox State
Java quiz · Question 59What does this code print when the user checks the box?
Code
1CheckBox agree = new CheckBox("I agree to the terms");2Label result = new Label();34agree.setOnAction(e -> {5 if (agree.isSelected()) {6 result.setText("Accepted");7 } else {8 result.setText("Not accepted");9 }10});