Im having issues now with static and non staic errors. with sertain variables unable to find the main method.
I have strated the program by creating a seperate file which instantiates the class. like so:
public class StartUp {
public void main(String[] args) {
MainDriver theMainDriver = new MainDriver();
theMainDriver.start();
}
}
Within certain classes in the program it passes variables back to the mainDriver. But when I try to refrence it to, I get the error “cannot find symbol variable theMainDriver” .
e.g:
public void getEmployee() {
theMainDriver.setEmployee(theEmployee);
}
public void getEmployeeID() {
theMainDriver.setEmployeeID( randomIDno);
}
how can I declare the main Driver in a way that makes it more visible to other classes.
It does find the main driver if I do this MainDriver.setEmployeeID( randomIDno); but then it has issues with non static method cannot be referenced from a static context.
You can do the following:
And call from any class as follows: