Various Java programs to illustrate various concepts
A Hello World! Java program.
Calling Methods. A sample of how to call methods in the same class.
For loop. A simple example of using for loops to calculate factorial. Uses the built in int data type so only good to 13!
Enhanced for loop
Value Parameters: An example that shows the behavior of value parameters. In Java all parameters are passed by value.
String Example. A few brief examples of String manipulations.
BinaryConverter. A program with examples of various Java syntax that converts a base 10 int to base 2 String.
PrimeEx A program with various approaches to determine if an int is prime or not. Used to demonstrate Java syntax. You need the Stopwatch class, a non standard Java class, as well.
Pointers as Value parameters
Array Examples
2D array Example. A simplified version of filtering a picture represented by ints.
2D array example. Very simple version of the Conway's Game of Life.
Getting input from Keyboard with Scanner class
Reading ints from file with Scanner class
Writing ints to file
Connecting to and reading from a web page.
Program to create ASCII frequency table from file and url. Demonstration of try / catch blocks. The CIA 2008 Factbook may be downloaded from Project Gutenberg.
IntListVer1 First version of the IntList class developed in class. Developing class to illustrate various class design and implementation issues in Java.
IntListTesterVer1
IntListVer2 Added default add method, equals method, and toString methods. Includes versions of toString using String concatenation and StringBuffer to illustarte performance differences.
IntListTesterVer2
IntListVer3. Added insert and remove methods.
SortedIntList. Inherits from InListVer3 to create a SortedIntList. Class is "broken" because random insertions still allowed.
GenericList. Altered the list to store anything, not just ints.
Die class. A class that models a playing die.
DemoClass: This