Need Assistance?

support@tutorialshub.in

Java Fundamentals & Environment Setup

Java Syntax, main() Method & Comments

ADVERTISEMENT
Java Free Lesson
5 min read
ADVERTISEMENT

Every executable Java application starts inside a main method, and the public class name must match the filename (App.java → public class App).

Breaking Down public static void main(String[] args)

  • public — Allows the JVM to call this method from outside the class.
  • static — Allows the JVM to invoke main without creating an object instance first.
  • void — The main method does not return a value.
  • String[] args — Captures command-line arguments passed when starting the program.
ADVERTISEMENT
Hi, I'm Tuby! Here to help you