Learn Java6Homepage « Learning Java6

Java is an object oriented programming language and computing platform that was first released by Sun Microsystems in early 1996 and has grown in popularity ever since. The Java language has gone through a lot of changes during its evolution and the table below outlines the major releases.

Release Name And Date Codename Known As ≈ Number Of Classes
JDK 1.0 (January 23, 1996)OakJava 1250
JDK 1.1 (February 19, 1997)Java 1500
J2SE 1.2 (December 8, 1998)PlaygroundJava 21600+
J2SE 1.3 (May 8, 2000)KestrelJava 21800+
J2SE 1.4 (February 6, 2002)MerlinJava 22700+
J2SE 5.0 (September 30, 2004)TigerJava5.03200+
Java SE 6 (December 11, 2006)MustangJava 63700+
Java SE 7 (July 28, 2011)DolphinJava 73900+

The release names in the table are somewhat confusing so lets go through them. In the first two versions the JDK stands for Java Developers Kit and these versions were known as Java 1. With the release of J2SE 1.2, because the changes were so large this version through J2SE 5.0 were prefixed with J2SE (Java 2 Platform, Standard Edition). The J2 denoting Java 2 and the SE to distinguish the standard edition platform from J2EE (Java 2 Platform, Enterprise Edition) and J2ME (Java 2 Platform, Micro Edition). Things got even more confusing with the release of J2SE 5.0 which also included changes large enough that it became known as Java5.0 even though in reality it was version 1.5. So Java 1.5, Java5.0 and Java5 all refer to this release (there was never a Java 3 or Java 4). From version Java SE 6 onwards the J2 prefix and the .0 suffix were dropped and versions were simply known as Java6, Java7 from then onwards. This site is all about Java6 and we will be using this without the .0 suffix from now onwards.

So why Java6 I hear you ask? Well the Java5 upgrade to the language is covered at the Java5 Tutor site and the Java 7 upgrade to the language will be covered in a future website.

So Why Use Java?

The Java programming language is platform independent and can be run in a wide variety of environments. This is achieved via the Java compiler which converts a document into Java bytecode, which is a highly optimized set of instructions designed to be executed by the Java run time system which is more commonly known as the Java Virtual Machine or JVM for short. In essence the JVM is an interpreter for the Java bytecode and as such, when implemented on a platform can run any Java bytecode on that platform. So although the implementation of the JVM may differ from platform to platform the underlying bytecode is always the same. This flexibility is what makes the Java language so portable.

The use of the JVM also makes the use of Java more secure as the JVM acts like a firewall between the application and a computer. All Java programs are under the control of the JVM and as such the JVM can stop adverse side effects propogating outside the system.

Concerns in early releases of Java over the speed the language runs at, because it is an interpreted language, have since subsided as the JVM has been streamlined and improved. The advantages of portability and security have placed Java at the top of the tree of object orientated programming languages and is why the language is used in so many diverse applications today.

Beginning Java6

We start out by downloading a JDK and setting up our environment before beginning our journey into Java6. With the environment set up we introduce the code structure of a Java source file and look at syntax. After this we look at the primitive variables available in Java before discussing method scope. We then take an in-depth look at the symbols used for mathematical and logical manipulation that are recognized by the compiler and commonly known as operators. Every computer language has conditional branching and loop structures and Java is no exception. We finish off this section with a look at the conditional and loop statements available in Java6.

Objects & Classes

The main emphasis of the Beginning Java6 section of the site was an introduction to the basic building blocks required to write a Java program. This section is all objects and the classes used to construct them. We start by looking at a predefined data type, the Array object. Investigation of this class will give us an insight into using objects and classes before we start to create our own. After this we examine class structure and the syntax required for class construction, before investigating reference variables and how to use them in Java. We have used methods throughout the lessons so far, and the next lesson in the section goes into these members in much more detail. We then look at instance variables and their scope before studying constructors which are used to instantiate our objects. We finish the section by taking an in-depth look at static members, followed by a new feature in Java6, enumerations.

OO Concepts

Up until now, for learning purposes, we have ignored many important object oriented concepts that we can use within our Java programs. This neglect is rectified in this section where we start our study of OO concepts by looking at encapsulation and how to protect our data. We then tackle inheritance over two lessons where we look at creating hierarchies, overriding methods and the use of super. After this we look at abstraction and how we apply it to our classes and methods. We then examine polymorphism and how to use it with our methods, arguments and return types. Our investigation of polymorphism continues as we investigate interfaces and their usage. We then return to the idea of encapsulation as we look into nested classes, what they are and how to use them. We finish the section with a detailed look at the Object class and the methods we inherit and can override in our subclasses.

Flow Control

In this section we finish our studies on flow control by studying exceptions and assertions. Firstly we look at Java exceptions where we make a thorough investigation of the exception hierarchy and how Java's exception architecture hangs together. With an overview of exceptions under our belt we look at handling the various forms of exception in our code. After this we look at declaring and throwing exceptions in our code, which we can deal with straight away or allow to propogate up the stack to be dealt with elsewhere. We finish off our investigation of exceptions by creating our own bespoke checked and unchecked exceptions for when needed. With exceptions covered we turn our attention to the assertion mechanism available in Java. We learn appropriate uses of assertions and when not to use them. We also look at the runtime commands used to enable assertions, as and when required.

API Contents

In our fifth section on learning Java6 we begin our investigations of the Java API by looking at the String, StringBuilder and StringBuffer classes. These predefined classes come with a multitude of methods for working with strings and are part of the java.lang package which is implicitly imported into all our Java programs for us. After this we broaden our horizon of Java by investigating classes that are not implicitly imported into our programs. Before we look at other parts of the Java API however, we need to take a closer look at how Java stores predefined classes into namespaces, which Java calls packages, and how we can import these packages into our programs. With knowledge of packages under our belt we can now look at parts of the Java API outside the default java.lang package. Our first port of call is how we use I/O in Java and for this we will look at the java.IO package. We start our exploration of Java I/O by looking at the class hierarchies involved and then take an in-depth look at the byte stream classes and character stream classes used for this purpose. After this we look at the classes available for working with dates, numbers and currencies. Most languages have an implementation of regular expressions and Java is no exception and we look at the classes used for pattern matching. We finish off our tour of the Java API by looking at formatting and tokenizing our data.


This section is about multithreading and how to run parts of our program concurrently. We explain the terminology behind concurrency before looking in detail at running parts of a program concurrently by subclassing the Thread class and also by declaring a class that implements the Runnable interface. Running separate threads at the same time is great and we can certainly improve the performance of our programs using multithreading. But what happens when concurrent threads need to access and update some shared resource? Java deals with this problem with synchronization and we investigate how we can control access to our code by synchronising at the method or block level. After this we investigate thread priorities and how we can have the priority set automatically by the invoking thread or assign thread priorities ourselves using methods of the Thread class. We finish our look at concurrency by looking at how threads can interact with each other when they are within a synchronized method or code block.


In our last section concerned with certification we look at collections and investigate generics. We start by defining what a collection is and look at some diagrams of the collection types to get a feel for the various structures of the classes and interfaces involved. After this we make an in-depth investigation of generics and unravel the strange syntax we get with it. Following on from this we examine the various hierarchies within The Collections Framework by taking a look at some concrete implementations of Sets, Lists, Maps and Queues. We than look at the java.util.Arrays and java.util.Collections classes that contain a lot of static utility methods we can use with our collections. We finish the section by finding out how to sort our collections using the Comparable and Comparator interfaces.

Swing & RMI

We start the section by looking at Graphical User Interface (GUI) concepts and the MVC paradigm and how this pattern can help in removing some of the complexity from the disparate parts of an application. We then introduce the Abstract Windowing Toolkit (AWT) and Swing libraries with an overview of those parts of these libraries we are interested in to create our own GUIs within java. In Swing we store components within other components and we look at the javax.swing.JFrame top-level container class, adding depth to frames using panes and the javax.swing.JPanel background container class. Following on from this we take a look at several of the interactive Swing components available for use when creating our GUIs. Then we take a look at several layout managers we can use to organise the components within our GUIs. We also need to make our GUIs interactive so what we require is a mechanism where we are alerted to a user event, such as a button being clicked, and make a response to it. We look at how we can intercept user events and action them, which is known as event handling. We finish our lessons on Swing by looking at dialogs which are windows that are displayed within the context of a parent window. Dialogs are often used to display some information, show messages to the user or prompt the user for input. We finish the section by looking at Remote Method Invocation more commonly known as RMI and how we can use it to access methods remotely.

<<  Homepage                    Beginning Java6  >>

go to home page Java6 Tutor Homepage go to top of page Top