Tuesday, March 10, 2009

Why variables/objects in java bean classes are declared as private

Question :Why variables/objects in java bean classes are declared as private?
Question by Rajesh (Beans)

Answer :Since you do not want users to access these objects directly and wanted
users to get access to these objects
using getter and setter methods.

No comments: