Hi all,
i have a doubt, In below class
class employeeVO {
private String name;
public void setName(String name)
{
this.name=name;
}
public String getName()
{
return name;
}
}
We are using POJO class like this, but why we are keeping variable scope as private,
In setter & getter we are not doing anything, then we can keep variable as public & directly access like
below right.
employee empObj = new employee();
empObj.name = "Test"
String name = empObj.name
what is the intention behind to keep variable scope as private ?