1 | Since Java is object-oriented, programs are organized into modules called classes, which may have data in variables and functions called methods. |
2 | class HelloWorld |
3 | { public static void main ( ) |
4 | { System.out.println("HelloWorld"); |
5 | } |
6 | } |
7 | Each program is enclosed in a class definition |
8 | Main() is first routine that is run |
9 | Syntax is similar to C |
10 | Use braces for brackets and |
11 | semicolons after each statement |
12 | Upper and lower case matter! |
13 | This notation is |
14 | Package.class.method and is |
15 | used to refer to public methods in other classes |
16 | use class.method if package included |
17 | some classes can be accessed automatically |