Demonstration Programs

Input and output

Text and binary file I/O

Layout managers and GUIs

Collections: Vector, ArrayList, HashMap, LinkedList

Arrays (includes collections and iterators)

  • TestArrays.java: demo of Arrays and Collections
  • TestSync.java: demonstrates how List objects can change underlying array
  • TestEnumeration1.java: creating and using an Enumeration object
  • TestIterator1.java: using an Iterator
  • TestIterator2.java: using a ListIterator
  • Array0.java: using "String[] args" to get command line arguments (CIS 160)
  • Array1.java: basic array usage; passing arrays to methods (CIS 160)
  • Array2.java: reading array data from a file; dealing with partially filled arrays (CIS 160)
  • Array3.java: processing file data before saving it in an array; using methods to process data (CIS 160)
  • Array4.java: reading parallel arrays from file (CIS 160)
  • Array5.java: linear searching of arrays; using parallel arrays (CIS 160)
  • Array6.java: sorting parallel arrays (CIS 160)
  • Array7.java: using arrays of objects (CIS 160)
  • Array8.java: using the Arrays class to sort an array of objects
    array8data.txt: data file for Array8.java (make sure after transferring data file that there is no blank line after last record and theat each record is on its own line) (CIS 160)
  • Array9.java: reading an indeterminate number of items into an array with error checking (CIS 160)
  • SortArray1.java: use Array class to sort an array of Integer objects
  • SortArray2.java: use Array class to sort an array of ints
  • SortArray3.java: use Array class and a custom Comparator to do a customized sort of an array of objects
  • MultiDim1.java: multidimensional array demonstration

Class, interface, inheritance, composition

  • Course.java: demonstrates a basic class
  • TestClass.java: demonstrates some basic class concepts
  • Drawable.java: an interface that contracts for a draw method
  • Point.java: a simple class that specifies a point on a 2D grid
  • Shape.java: an abstract class the implements Drawable, and contains a Point
  • Circle.java: a subclass of Shape that implements Shape's abstract methods
  • Rectangle.java: a subclass of Shape that implements Shape's abstract methods
  • TestShapes.java: an Applet that tests out the classes and interface used for this demonstration
  • TestShapes2.java: the JApplet version of TestShapes.java

Recursion

Searching, and sorting

Variable argument lists, autoboxing, assertions, JavaDoc

Multithreading demonstrations

Strings and Regular expressions

Exceptions

Data structures

Various topics