← Back to Question List
Java Quiz #59
CheckBox State
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();34agree.setOnAction(e -> {5 if (agree.isSelected()) {6 result.setText("Accepted");7 } else {8 result.setText("Not accepted");9 }10});