This directory contains example Java code.
- Hello.java
- this file is the cannonical "hello world" program. It's
primary use is as an example and template for writing a
stand-alone "main program".
- InputExample.java
- this program demonstrates how to perform input by
wrapping a
Scanner
object around the
System.in
object. The "Old" version shows you how to do this
in versions of Java prior to v1.5.
- ArgsExample.java
- this program demonstrates my preferred pattern for
handling command-line input from the
args
array in main()
.
- Factorial.java
- this program demonstrates how to process command-line
arguments and use recursion; exception-handling is also
demonstrated.
- VectorStack.java
- is a Stack class that is built using a
Vector
. This
example shows how one might build a data structure
as well as examples of how to handle exceptions. In
addition, this class includes a static
main
method
at the end that can be used to test the data
structure.
- Inheritance
- this directory holds a few classes and a test program that
show how inheritance works and demonstrate some
polymorphic behavior vi
println()
and
toString()
.
NOTE: The code in this directory was thrown together
quickly and is NOT sufficiently documented with
Javadoc-type syntax. Don't expect to hand something like
this in and get documentation points!
Apache/2.4.52 (Ubuntu) Server at dhansen.cs.georgefox.edu Port 443