UNB/ CS/ David Bremner/ teaching/ Java Programming Examples

Here is a collection of Java classes and snippets (partial class definitions or single method definitions). This is mainly intended to support students taking java programming classes from me.

Much of this code is not up to assignment standards because it has been kept terse to fit on overhead slides.

On the right you can find a list by tag.

binary file 2D array Comparable DBFrame GUI HistoryPane InputStreamReader Integer Iterator JList JScrollPane KeyPad MouseEvent RPNCalc Reader Swing Vector array base benchmark binary file binary search binary tree bitmap buffered input buffered stream callback ccj checked exception compile error conversion driver error handling exception factorial file hanoi hierarchy image processing inheritence insert insertion sort interface iterator linear search linked list listener merge merge sort model-view-controller object object i-o o parse partially filled array puzzle queue readLine recursion reverse scrollbar search selection sort sequential search serialize singly-linked sort sorting stack stream string text file timer timing toString undo wrapper array selection sort sorting week 3

ATMSimulation.java

AccountTest.java

ArrayStatic.java

ArrayTest.java

ArrayUtil.java

Assert.java

Average.java

AverageSalary.java

BangBuck.java

Bank.java

BankAccount.java

BankAccountTest.java

BarGraph.java

Belch.java

BestData.java

BestPrice.java

BestProduct.java

BigCalculator.java

BigRational.java

BinarySearch.java

BinarySearchTree.java

Bitmap.java

BitmapPanel.java

BitmapReader.java

BitmapWriter.java

Bsearch.java

BubbleSort.java

BucketSort.java

Buffon.java

ButtonTest.java

ByteIO.java

Calculator.java

CarDrawer.java

Catch.java

Catch2.java

CharExample.java

CharExamples.java

CheckedException.java

CheckedException2.java

CheckedException3.java

CheckedException4.java

CheckingAccount.java

ChoiceTest.java

Choose.java

CircleTest.java

Click.java

CloudTest.java

Coins1.java

Coins2.java

Coins3.java

Coins4.java

Coins5.java

Coins6.java

ColorSelect.java

ComparableNode.java

ComparableSearch.java

ComparableTree.java

Computer.java

ComputerArray.java

ConsoleReader.java

Count.java

CounterFrame.java

Crypt.java

CustomException.java

Customer.java

CyberPetList.java

DBFrame.java

DBFrame2.java

DataStreamTest.java

Database.java

DebugConsole.java

Dice.java

Dictionary.java

Dictionary2.java

Dictionary3.java

DivideByZeroException.java

DoublInv.java

DoubleLinked.java

EggApplet.java

Eggs.java

Elist1.java

Elist2.java

Elist3.java

EmplFile.java

EmployeeLink.java

EmployeeList.java

EmployeeTest.java

EmptyFrame.java

EmptyStackException.java

Esearch.java

EvalNumber.java

EvalNumber2.java

EventApplet.html

EventApplet.java

EventFrame.java

ExceptionTest.java

ExceptionTest2.java

ExceptionTest3.java

ExceptionTest4.java

Exotic.java

Expression.java

Fac.java

Factorial.java

FakeEventApplet.java

FibLoop.java

FibTime.java

FibTrace.java

FileCopy.java

FileCopy2.java

FileCopy3.java

FileCopy4.java

FileCopy5.java

FileStreamTest.java

Finally.java

Finally2.java

Finally3.java

FontApplet.java

Foo.java

Fractal.java

FrameTest1.java

FrameTest2.java

GComparableNode.java

GenericNode.java

GoodPrime.java

Guess.java

Hanoi.java

Hello.java

HelloWin.java

HistoryPane.java

HistoryPaneClient.java

InputTest.java

Insert.java

InsertionSort.java

IntLink.java

IntList.java

Intersect.java

Intname.java

Intsect1.java

Intsect2.java

Intsect3.java

Intsect4.java

Invest.java

InvoiceTest.java

JListExample.java

JUndoTextField.java

KeyFrame.java

KeyPad.java

KeyPadClient.java

KeyPadTest.java

Leap.java

LineTest.java

Link.java

LinkedQueue.java

LinkedStack.java

List.java

ListMerge.java

ListNode.java

ListTest1.java

ListTest2.java

Lsearch.java

MMSortTest.java

MakePassword.java

MathAlgs.java

Matrix.java

Maze.java

MazeTest.java

MenuTest.java

MergeComparable.java

MergeList.java

MergeSort.java

MergeSort3.java

MergeSortTest.java

MergeSortTime.java

MouseSpyApplet.java

MoveRectangle.java

Mproduct.java

MyMergeSort.java

MyMergeSort2.java

Node.java

NumToString.java

NumberEntry.java

NumberLines.java

NumberLines2.java

NumberPad.java

NumberPadClient.java

NumberPadTest.java

Numeric.java

ObjArray.java

ObjFact.java

ObjectSaver.java

Order.java

OurException.java

OutputStreamTest.java

Overflow.java

PVReader.java

PVReader2.java

PVWriter.java

PVWriter2.java

ParenParser.java

PeopleVec.java

Person.java

Phoenix.java

PhoneLink.java

PhoneList.java

PhoneNode.java

PlotData1.java

PlotData2.java

PlotProducts.java

PointTest.java

Polite.java

PolygonTest.java

Power.java

PrimeBug.java

PrintMethod.java

Product.java

ProductTest1.java

ProductTest2.java

PromptField.java

PromptFieldTest.java

Propagate.java

Propagate2.java

Queue.java

QueueEmptyException.java

QueueFullException.java

QueueMaze.java

QueueTest.java

RETest.java

RPNCalc.java

RPNCalc2.java

RPNCalc3.java

RPNCalc4.java

RPNCalc5.java

RPNConsole.java

RPNStack.java

RPNStack2.java

ReadAge1.java

ReadAge2.java

RectangleApplet.java

RectanglePanel.java

Recurse.java

RecurseReverse.java

RecursiveComparableSearch.java

Remove1.java

Remove2.java

RemoveAt.java

Reverse.java

Richter.java

Rot13.java

Rotate.java

Rude.java

RunLength.java

SavingsAccount.java

SearchTest.java

SearchTime.eps

SearchTime.gnu

SearchTree.java

SearchVec.java

SelSortTest.java

SelSortTime.java

SelectionSort.java

Sentinel1.java

Sentinel2.java

SequentialSearch.java

SerialBitmap.java

Shuffle.java

Sierpinski.java

SillyKeypad.java

SimpleNode.java

SingleLinked.java

Skater.java

SliderTest.java

Smiley.java

SmileyPanel.java

SortTest.java

SortTime.java

Split.java

SqrtTest1.java

SqrtTest2.java

SqrtTest3.java

SqrtTest4.java

SqrtTest5.java

Square.java

StackMaze.java

StackMaze2.java

StopWatch.java

StreamTokenizerExample.java

StringParser.java

StringParser2.java

StringToNum.java

StringTree.java

StupidIterator.java

Table.java

Table2.java

Tax.java

TaxSort.java

Test.java

TextFrame.java

TextTest.java

Time1.java

Time2.java

TimeDepositAccount.java

Trace.java

TreeTest.java

TryFinally.java

TwoDArray.java

UndoFrame.java

UndoTextArea.java

Unique.java

UnitConverter.java

VecStack.java

Volume.java

Vproduct.java

WindowCloser.java

Words.java

WorkStation.java

Wrapper.java

arrayprint1.java

black.pbm

catch1.java

catch2.java

catch3.java

handler1.java

handler2.java

message.txt

mystery.dat

noisy.pbm

quickbrown.txt

randomPerm.java

tryFinally.java

utf8.dat