Check out example codes for "java getter". It will help you in understanding the concepts better.

Code Example 1

public setValue(value) {
  this.value = value;
}

Code Example 2

public getValue() {
  return value;
}

Learn ReactJs, React Native from akashmittal.com