I am attempting to create get/set class with Java. However, I am having trouble getting the data back from the class afterwards.
public class ARNStorage {
String arnStorage;
public String getArnStorage() {
System.out.println("Got endpoint: " + this.arnStorage);
return arnStorage;
}
public void setArnStorage(String arnStorage) {
this.arnStorage = arnStorage;
System.out.println("Saved endpoint: " + this.arnStorage);
}
}
To store the String, I use the following (this works)
public void storeEndpointArn(String endpointArn) {
ARNStorage endPoint = new ARNStorage();
endPoint.setArnStorage(endpointArn);
System.out.println("Storing endpoint: " + endpointArn);
}
However, to retrieve the String, I attempt retrieve it this way
public String retrieveEndpointArn() {
String endPointArn = ARNStorage.getArnStorage();
System.out.println("Retrieved endpoint: " + endPointArn);
return endPointArn;
}
However, this returns a non-static method getArnStorage() which cannot be retrieved from a static context. My understanding a static context is that it cannot be called on something that doesn't exist.