I have a class called Media that has a method called setLoanItem :
public void setLoanItem(String loan) { this.onloan = loan; }
I am trying to call this method from a class named GUI as follows:
public void loanItem() { Media.setLoanItem("Yes"); }
But I get an error
non-static setLoanItem method (java.lang.String) cannot reference a static context
I'm just trying to change the onloan variable in the Media class to "Yes" from the GUI class.
I looked at other topics with the same error message, but nothing clicks!
java static compiler-errors
Daniel Mckay Feb 07 2018-11-14T00: 00Z
source share