Bean class /encapsulation means variable should be private & getter & setter should be public. Because of the reason data hiding.Anybody can't access this variable out side.
My Question is :`With the getter/setter method we can access/set variable from outside class.Then why we need to keep that variable private && how we can tell this is data-hiding?
Actually i like to get some explanation because , without any idea just i am doing project like this. Please if there are any mistake or unclear question, please forgive me.
Please anybody explain this.
Thanks in advance
int, but you could get and set aStringvalue parsing it... in a transparent/incapsulated waysetter/getteras filter concept. For example if you want authorize anyone that callsetter, you do this task into setter method.