What does public static void mean in Java?
I’m in the process of learning. In all the examples in the book I’m working from public static void comes before any method that is being used or created. What does this mean?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s three completely different things:
publicmeans that the method is visible and can be called from other objects of other types. Other alternatives areprivate,protected,packageandpackage-private. See here for more details.staticmeans that the method is associated with the class, not a specific instance (object) of that class. This means that you can call a static method without creating an object of the class.voidmeans that the method has no return value. If the method returned anintyou would writeintinstead ofvoid.The combination of all three of these is most commonly seen on the
mainmethod which most tutorials will include.