By making setter methods private, one can make a class as immutable. Once the attribute values are set during object creation, then those attribute values cannot be modified at runtime. Values like authentication information etc can be stored in these kind of immutable objects
Posts made by nageshever
How can you make a class immutable
RE: Can the overridden methods in case of inheritance have different return type ?
When return type of a method in child class is not same as the base class method return type, then it is no more a overriding and compiler will complain it as a wrong. When compiler allows the subtype as return type then it is following SOLID principle.