Originally posted by Venkatesh Sai:
2. In scenario where in u just write some java beans to tranfer some data across/within your application, u need not have getter and setters, u can directly make your class variables public.
In my experience, it is better to have getter/setter methods in the first place. If some computational logic related to the data is to be added later on (possibly due to a change in the requirement), the bean class should be able to handle that without impacting the complete application.
Making member variables public instead of having a get/set method is quite a micro-optimization.