up previous next contents
Next: Variables, constants, and keywords Up: First Steps with Java Previous: A first application   Contents

main

  • When you run a Java application, the system locates and runs the main method for that class.
  • The main method must be public, static, and void.
  • The main method must accept a single argument of type String[].
  • The arguments in the String array passed to main are program arguments, or command-line arguments.
  • An application can have any number of main methods, because each class can have one.
  • This is good, because each class can have a main method that tests it's own code.


up previous next contents
Next: Variables, constants, and keywords Up: First Steps with Java Previous: A first application   Contents