One of hundreds of answers available with our premium content service.
A: The main method must be declared public static void because it is invoked when the Java Virtual Machine first starts up, before any Java object instances exist. The main method may reference any number of static variables and call static methods. Any series of calls to other static methods only extends this original static context. To reference a non-static or instance variable from the main method, you must first instantiate the relevant object, even if it is the host of the main method itself, as below.
… full answer hidden
Premium members click below for full answer
I get "non-static variable this cannot be referenced from a static context"!