In the example “Exercise: thermometer” sample solutions shows the int temperature’s variable value being changed from -5 to 10. Isnt an int a primitive data type that is immutable?
class Temperature {
public static void main(String[] args) {
int temperature = -5;
if(temperature < 0) {
System.out.println("It's very, very cold!");
}
temperature = 10;
if(temperature >= 0) {
System.out.println("It's not so cold!");
}
}
}
Course: Educative: Interactive Courses for Software Developers
Lesson: Educative: Interactive Courses for Software Developers