private final double MAX_RANDOM_VALUE = 10.0;
private void lblQuestionComponentShown(java.awt.event.ComponentEvent evt) {
int num1 = (int) (Math.random() * MAX_RANDOM_VALUE) + 1;
int num2 = (int) (Math.random() * MAX_RANDOM_VALUE) + 1;
char operator = getRandomOperator();
String question = "What is " + num1 + " " + operator + " " + num2 + "?";
lblQuestion.setText(question);
int correctAnswer = getCorrectAnswer(num1, num2, operator);
btnSubmit.setActionCommand(String.valueOf(correctAnswer)); // Store the correct answer in the button's action command
// Clear the answer text field
tfieldAnswer.setText("");
}
i tend to think of anything immutable as capable of being a true constant