JSlider getValue() condition

Solution 1:

You have extra semicolons ; at the end of each if statement, which you shouldn't. Instead, it should look like this:

Update:

As @c0der correctly pointed out, it would be more efficient to use else if, rather than having the program to go through each if statement in the code. Thus, the below is modified in accordance with that.

public void stateChanged(ChangeEvent e) {
    int value = slider.getValue();
    System.out.println(value);
    if (value < 25)
        rating.setText("Bad!");
    else if (value > 25 && value < 50)
        rating.setText("Fine!");
    else if (value > 50 && value < 75)
        rating.setText("Good!");
    else if (value > 75)
        rating.setText("Best!");
}