Check out example codes for "how to access private vairable in java method". It will help you in understanding the concepts better.

Code Example 1

public Class A{

   private String myData;

   public String getMyData(){
        return myData;
   }

   public void setMyData(String data){
        this.myData=data;
   }
}

Learn ReactJs, React Native from akashmittal.com