Recent Changes - Search:

Java Tutorial

edit SideBar

Class

These pages make up the course notes for my Java programming course (run at Dallam, Milnthorpe, Cumbria). Hopefully they also make a useful self-learning tutorial.

A class is the basic Unit of a java program. A public class (i.e. the sort of class we normally use) must be in a file of the same name. For example a class called SayHello must be stored in a file called SayHello.java

The following defines a simple class as stated on the first line. This java code should be saved in a file called SayHello.java

public class SayHello {

        public static void main(String[] args) {
                System.out.println("Hello World!");
        }//end of main method

}   // end of class SayHello
 

Creative Commons License

This work is Copyright Chris Hunter 2007, you may use it for non-commercial purposes
under the Creative Commons license Creative Commons Attribution-Noncommercial-Share Alike.

Edit - History - Print - Recent Changes - Search
Page last modified on May 08, 2007, at 09:47 PM