class MyClass { int weight; MyClass(int w) { weight = w; } } public class MainClass { final MyClass w1 = new MyClass(1500); void test() { w1 = new MyClass(1400); // Illegal w1.weight = 1800; // Legal } }