Why is the main () method special in a Java program?

The main method in Java is public so that it’s visible to every other class, even which are not part of its package . if it’s not public JVM classes might not able to access it. 2. The main method is static in Java so that it can be called without creating any instance.7 Eyl 2021

Sizin İçin Seçtik  How methods are written in Java?

Leave a Reply

Your email address will not be published. Required fields are marked *