As we know in java if a class cannot be accessed, its members can never be accessed too. So if a class is not given the public modifer the methods of that can never be accessed by any outside entity. I dont know whether there is an exception for static methods or not. But if the answer is no, then what is the logic behind giving the main method a public modifier? Because the class within which i am enclosing my main method is not public. So theoretically JVM being an outside entity cannot access the main method even if it is declared as public and static. But my programs are still running. How this happen??