Why Not Try: Free On-line Java Tutorials |
The following tutorials were written by Davin Pearson as supplementary material to the University of Canterbury COSC121 course teaching the Java language. At the top of each tutorial is a hyperlink to a model answer, but don't look at the answer until you have completed all the questions of the tutorial! DISCLAIMER: These tutorials were not developed by TEAM COSC and are independent any COSC course. They are solely intended as a study aid. When you have finished the tutorials, check out my Website: davin.50webs.com |
Number | File(s) | Notes |
---|---|---|
1 | PersonTest.java |
Contains a simple class Person for representing the
concept of a human being, and a driver class
PersonTest .
Key concepts:
|
2 | CitizenTest.java |
Contains a class Citizen for storing a person's
financial information including their salary, savings
and loan (if they have one). Tax is paid by the citizen
and a class called Government is used to keep track
of the total tax paid. The classes are driven by
CitizenTest .
Key concepts:
|
3 | DogTest.java |
An example involving three classes Flea , Dog and
DogOwner to represent the idea that a dog has a flea
and a dog-owner has a dog. The class DogTest is the
driver class.
Key concepts:
|
4 | RunnerTest.java |
Two classes SportsShoe and Runner for modelling
runners and their shoes, together with a driver class
called RunnerTest .
Key concepts:
|
5 | StaticTest.java ,StaticTest2.java . |
This tutorial attempts to convey the meaning of the
static keyword by showing firstly an example
StaticTest.java where static is used and then
secondly an example StaticTest2.java which is the
same example with static removed.
|
6 | ForTest.java |
This tutorial gives you practice in writing
for loops. A for loop has the following
structure:
for (Init-part; While-part; Increment-part) Body-partThis tutorial shows you how the different parts of the for loop affect the behaviour of the loop.
|
7 | LoopTest.java |
Java's three different looping constructs: for ,
do and while . This tutorial takes you through
the process of rewriting a for loop into a do
loop and a while loop.
|
8 | ScrabbleTest.java |
String manipulation. Useful methods to remember are
length() for getting a string's length, and
charAt(NNN) for inspecting the character at location
NNN in a string.
|
9 | ArrayTest.java ,ArrayTest2.java |
Arrays. There are two kinds of arrays: arrays of
references, and arrays of the built-in types. The
built-in types are:
The file |
10 | CarTest.java . |
Advanced tutorial involving two classes WARNING: Difficult tutorial. |
11 | TurtleTest.java |
Linked lists. Dr Seuss' story Yertle the Turtle
describes how a turtle called Yertle sits at the top of
a pile of other turtles. In this example, the pile of
turtles is represented by a linked list of WARNING: Difficult tutorial. |
12 | InheriTest.java |
Theoretical example of inheritance. The file
The main thing that this tutorial shows is the idea that
inheritance is a non-symmetrical relationship. For
example: the |
13 | StarWars.java |
Practical example of inheritance.
The file The tutorial shows how inheritance can be used to reduce the amount of duplication of code. |
14 | AnimalTest.java |
Arrays, inheritance and polymorphism. |