Introduction to Computer Science using Java

Bradley Kjell

Interactive Notes:

These notes cover most of a beginning course in computer science using Java. They assume no background in programming. They are written to supplement a textbook or to be used alone. They provide discussion and simple examples of the important topics in programming. You can learn quite a lot about Java by going through these notes (and by running and playing with the programs, as discussed in chapter 7.) But to get a thorough grounding in the language you should also study a text book and write many programs on your own. Try to do one or two of the suggested programming exercises per chapter.

For maximum benefit, go though these notes interactively, thinking about and answering the question at the bottom of each page. There are about 15 pages per chapter. If you spend about 3 minutes per page each chapter will take about 45 minutes; much more, if you copy and run some of the programs. If you are a beginning programmer, plan on spending more than a month with this.

These notes assume that you have the Java Development Kit (JDK) version 1.1 or later from Sun ( and a simple text editor such as NotePad. For more about these notes check the frequently asked questions.

Part 1: Hardware and Software

Part 1 consists of general computer science topics but does not say much about Java. Topics include a general discussion of hardware and software, the nature of analog and binary signals, machine language and high level languages, language translation and interpretation. Readers who already know these topics can skip to Part 2, where Java instruction begins.

Part 2: Running Java Programs

Part 2 explains how to run Java programs. First, it discusses translating Java source code into bytecodes. Then it discusses how bytecodes are interpreted. All readers should look at this section. Next the notes explain how to create a Java program with the Windows Notepad editor and how to run it using the Java Development Kit.

Part 3: Java Programming

Part 3 contains notes on how to program in Java. It assumes you know how to run the programs once you have written them. The notes are written so they can be used with any Java development environment.

Part 4: Object Oriented Programming

Part 4 contains notes on Object Oriented programming in Java. It starts with a general introduction to the concept of software objects, and then moves on to how these concepts are implemented in Java.

Part 5: Applets and Graphics

Part 6: More Java Programming Features

This section discusses additional features of Java, such as additional language features for incrementing and decrementing variables, convenient ways to create loops, and arrays.

Part 7: Advanced Object Oriented Programming

This section discusses advanced features of object oriented programming that will be needed for programming graphical user interfaces.

Part 8: Graphical User Interface Programming

This section tells you how to program graphical user interfaces using the Java 1.1 Abstract Windowing Toolkit (AWT).

Part 9: Exceptions and IO Streams

This section discusses how Java handles errors through its Exception mechanism. Then it discusses input and output with disk files and other data streams.