Basic HTML version of Foils prepared 7 Sept 1997

Foil 13 The Simplest Java Application: Hello, World!

From Introduction to Java to be used in (Scientific) Computing Basic Simulation Track for Computational Science CPS615 -- Fall Semester 97. by Geoffrey C. Fox, Nancy McCracken


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

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Nov 29 1998