Basic HTML version of Foils prepared 16 May 98

Foil 13 The Simplest Java Application: Hello, World!

From Introduction to Java to be used in (Scientific) Computing CEWES Java Tutorial -- Spring Semester 98. by Geoffrey C. Fox, Nancy McCracken


Since Java is object-oriented, programs are organized into modules called classes, which may have data in variables and functions called methods.
class HelloWorld
{ public static void main (String[] args )
{ System.out.println("HelloWorld");
}
}
Each program is enclosed in a class definition
main() is first routine that is run
Syntax is similar to C
Use braces for brackets and
semicolons after each statement
Upper and lower case matter!
This notation is
Package.class.method and is
used to refer to public methods in other classes
use class.method if package included
some classes can be accessed automatically



© 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