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

Counter Button Logic

mediumJavaFX

What happens each time the button is clicked?

📄 Code

1Label countLabel = new Label("0");
2Button btn = new Button("Add");
3 
4final int[] count = {0};
5btn.setOnAction(e -> {
6 count[0]++;
7 countLabel.setText(String.valueOf(count[0]));
8});