I am trying to use accessors (Set/Get) methods in my program, and when I try to use the Get method in the main method, I get this error:
Cannot make a static reference to the non-static method getID()
from the type Student.
I am unsure how to go about fixing this. I'm a beginner at Java programming.
Here are the particular lines in question:
The set/get methods:
public void setID (String ID) {this.ID = ID;}
public String getID() {return this.ID;}
The error line:
System.out.println(Student.getID());
Any advice would be appreciated!*