0
In java why do we use Public and static in the main function/block ?
2 odpowiedzi
+ 3
Before the main function, there are no objects created. main () is static because there shouldn't be an object created.
+ 1
Static means that the method belongs to the class not an object. This is important because as @Jonas says there are not any objects yet. This means that if the method was not static you could not call it.
Public also makes the method assessable out side the class allowing windows to call it when it starts the process.