âGood Morning! said Bilbo, and he meant it. The sun was shining, and the grass was very green. But Gandalf looked at him from under long bushy eyebrows that stuck out further than the brim of his shady hat.
C / C++ / VC++ / MFC Interview Questionsâ > âCâ > âFrequently Asked Questionsâ > â. static is an access qualifier that limits the scope but causes the variable to exist through out the lifetime of the program.
The keyword static allows main() to be called without having to instantiate a particular instance of the class. This is necessary since main() is called by the Java interpreter before any objects are made. The keyword void simply tells the compiler that main() does not return a value.gain static method of a particular class can be accessed only by referring to the class like: Class_name.method_name(); So a class need not to be instantiated before accessing a static method. So the main() method is declared as static so that it can be accessed without creating an object of that class.