non-static method
Hello everyone ... I know this will be a pretty simple problem for some of you, but keep in mind that this is my first course in Java, so I am sorry if this question is dumb.
We have been studying methods, and are just now starting to write our own user-defined classes to create our objects from. I am working some of the problems in the back of the book, but I have run acorss a problem. I have two class files, Passenger, and AirPlane. They both compiled fine. I am working on my ProcessingApplication class, but I am stuck on an error.
ProcessingApplication.java:12: non-static method ControlPanel() cannot be referenced from a static context.
Here is my snippet of code pertaining to this error ...
public class ProcessingApplication {
public static void main( String args[] ){
//Main Control Panel
controlPanel();//call to control panel method
//close console
System.exit(0);
} //end method main
//method controlPanel - used to control navigation through program
//takes in no parameter, uses switch to determine what navigation to take ... returns nothing
public void controlPanel(){
//data members
String controlPanel = "";//control panel selection as string value
int navigate = 0;//parsed value for controlPanel
//prompt and parse
controlPanel = JOptionPane.showInputDialog( "Welcome! Please select your desired option ... \n 1) Enter flight customers \n 2) Run Cardinal Airlines Flight Reports \n 3) Exit system ");
navigate = Integer.parseInt( controlPanel );
//switch to control navigation
switch( navigate ){
case 1:
enterFlightInfo();
break;
case 2:
runFlightReport();
break;
case 3:
break;
}//end switch
}//end method controlPanel
Ofcourse enterFlightInfo and runFlightReport are going to be separate methods, all of which are prob. going to give me the same error.
I understand that private data members are hidden within that class file, and that static is a type of datamember that only has one copy which is accessible to all objects of that class. However, I have never run across this error I just posted. I tried putting keyword 'static' infront of void in my method declaration, but that didn't seem to work, plus that would just be rigging it to work.
If someone could just explain what the error means, and possible give me a little background information on the main method being static, that would be great. If I find an answer to my own question, I will reply to this post myself.
Thanks much
Rusty Rothwell

