Thursday, February 7, 2013

A Little Example of import and main:

A Little Example of import and main:

import javax.swing.*;    // all classes from javax.swing public class HelloWorld// starts a class  public static void main (String[] args) {  // starts a main method  // in: array of String; out: none (void)  }}public = can be seen from any packagestatic = not “part of” an object

Processing and Running HelloWorld:

javac HelloWorld.java
Produces HelloWorld.class (byte code)
java HelloWorld
Starts the JVM and runs the main method.

No comments:

Post a Comment