Back to Multiple Choice Quiz
Counter Button Logic
Java quiz · Question 47What happens each time the button is clicked?
Code
1Label countLabel = new Label("0");2Button btn = new Button("Add");34final int[] count = {0};5btn.setOnAction(e -> {6 count[0]++;7 countLabel.setText(String.valueOf(count[0]));8});