Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
It cannot be changed (you cannot change the link). And in this example, it is not changed, but the incremented value of counter is written into it.
You cannot change final fields after the object is created, but you can and should change them (set values for them) during the creation of the object. So there are no problems here. During the creation of the object, before calling the constructor, all fields are initialized, including this id field.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question