Java Programming Examples
- Hello.java, a simple stand-alone
application that asks your age and makes decisions based on it. Note
that it uses text I/O, which really isn't Java's strong point....
- HelloApplet.java, essentially the
same thing implemented as an Applet using AWT
- HelloJApplet.java, essentially the
same thing implemented as a JApplet using Swing (which is more
up-to-date, and generally preferred over AWT)
- HelloJFrame.java, essentially the
same thing implemented as a stand-alone GUI application using Swing
- UseUpMem.java, a program that repeatedly allocates memory
without ever explicitly deallocating it; the program does not run out of memory
and crash; compare with the C version, which does
run out of memory and crash (so would C++).
- ArrayTest.java, a demonstration of declaring, initializing,
passing, receiving, and looping through arrays. Note that in Java, arrays know their own
length.
- inheritance.zip, a collection of
examples illustrating
constructors, default arguments, inheritance, abstract methods, abstract
classes, invoking constructors and other methods from the superclass, and
interfaces.
- applet_examples.zip, a collection of
examples illustrating
Applets, paint() methods, repaint() as a form of animation, GUI
components, listeners, and inner classes.
You can also browse these examples in the applet_examples folder.
- IO.zip, a collection of examples
dealing with console, file, and network I/O in Java.
Last modified:
Stephen Bloch / sbloch@adelphi.edu