A
aleksandr.fisher
Java has getter and setter methods that gives you access to the class
members. They are also called accessors and mutators.
Let say you have the private member declared:
private int x;
The accessor method would be:
public getX
{
return x;
}
The mutator method would be:
public setX(int var)
{
x=var;
}
Using this methods you can apply validity checks to your variables.
members. They are also called accessors and mutators.
Let say you have the private member declared:
private int x;
The accessor method would be:
public getX
{
return x;
}
The mutator method would be:
public setX(int var)
{
x=var;
}
Using this methods you can apply validity checks to your variables.