mainMethod - The main method in Java A java application...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
The ‘main()’ method in Java A java application must contain a main() method . It is used to provide a standard convention for starting Java programs. The choice of the method name is somewhat arbitrary, and its signature looks like this: public static void main(String args[]) The method signature for the main() contains: A method signature is a collection of information about the method. It includes the method’s name, type, and visibility, as well as its arguments and return type. public : It must be declared  public  among ( pubic, private, and protected ) static : It must be declared  static  because it is being called on the class, not on a  specific instance (not part of objects).  void : Its return type is  void  because it doesn't return a value.  args : Its only parameter is a  String  array  that holds optional arguments entered at the  command line.   This parameter is the mechanism through which the runtime
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/20/2010 for the course MATH 107 taught by Professor Christinashow during the Spring '08 term at Mesa CC.

Page1 / 3

mainMethod - The main method in Java A java application...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online