+ 10
Set and Get methods are a pattern of data encapsulation. Instead of accessing class member variables directly, you define get methods to access these variables, and set methods to modify them. By encapsulating them in this manner, you have control over the public interface, should you need to change the inner workings of the class in the future. For example, for a member variable: Integer x; You might have methods: Integer getX(){ return x; } void setX(Integer x){ this.x = x; } source: https://stackoverflow.com/questions/6638964/set-and-get-methods-in-java
22nd Apr 2018, 4:34 PM
Baraa AB
Baraa AB - avatar