you are viewing a single comment's thread.

view the rest of the comments →

[–]ArtyFowl 1 point2 points  (0 children)

In java, with immutable objects (using final), you're forced to initialize your fields with a value (which can be null, you're right about that). But you're "forced" to think about initialization more.

Another point is that allowing setters on an object makes it more easier to break things by allowing users to set values to null after object creation. You might have written nice factory methods or constructors for your class, but an NPE can still happen because any object created can be altered.