Introduction to Computers, Programs, and Java

Some Important Dates in the History of Computers

1206

First programmable device (Turkish inventor Al-Jazari's water-powered Castle Clock)

1837

First description of the "Analytical Engine" by Englishm mathematician Charles Babbage (a fully programmable mechanical computer, able to perform calculations automatically)

1842

Ada Lovelace (daughter of poet Lord Byron) writes notes on how to program the analytical engine to calculate Bernoulli numbers [needed for uniform formula of the sum of the first n perfect m powers.])

1871

Babbage builds a piece of his "Analytical Engine (limited finances and other reasons kept it from being built)

1930's and 1940's
Digital computers at the dawn and during WWII (Konrad Zuse and the German Z1 and Z3 [1938-41] probably the first - used binary and tape; Colossus Mark I in Britain 1943 to break secret codes; ENIAC 1946 program-controlled by patch cables and switches, designed to compute artillery firing tables, but used for calculations for the hydrogen bomb.)

What is a Computer?

A computer is a machine that manipulates data according to a list of instructions, consisting of both hardware and software. Computers can take many different physical forms.

Modern computers generally have the following (hardware) components:

These components talk to one another through a communication channel called a "bus" to execute instructions in the form of computer programs (software).

CPU (Central Processing Unit)

Memory (RAM)

Memory Address Memory Content Decoded As
. . .
. . .
2000 01001010 character "J"
2001 01100001 character "a"
2002 01110110 character "v"
2003 01100001 character "a"
2004 00001000 number "8"
. . .
. . .

Storage Devices

Input and Output Devices

Computer Programs

Programming Languages (and where Java fits in...)

Java's History

Why Learn Java?

What makes up the Java Language?

There are several different editions of the JDK (Java Development Kit), which programmers use to write Java programs:

(Note: We will use J2SE in this course.)

There are several different versions of the JDK, as well, that have been released throughout the years:

Java Program Development

A Minimal Development Environment

If desired, one can create a java program using only a text editor, and compile and run it using only the command-line executable programs javac.exe and java.exe, respectively. javac.exe is the Java Compiler and produces class files containing Java byte code. java.exe is the Java Virtual Machine (JVM) and is able to execute the instructions written in Java byte code contained in the class files produced by javac.exe. Compiling and running things from the command-line is perhaps not the most efficient way of doing things, but it will work.

Integrated Development Environments (a.k.a. "IDE"s)

The process of writing programs is generally easier if one works within an IDE (Integrated Development Environment). This is a software application that provides comprehensive facilities for software development, such as:

Popular IDEs for Java:

We will use Eclipse in this course.

The Process of Writing a Program

However you plan on writing, compiling, and running your programs -- there is a certain order to the process, as suggested below:

  1. Create/Edit Source Code You can use a text editor, like "notepad" or "edit" in Windows, or "vi", "vim", or "gedit" in Unix, to type your Java source code. Several of these editors are designed to run from a command line interface (CLI) through a shell window. Each program file should have a "*.java" extension.
  2. Compile Source Code When the program is written, it is then compiled with the Java compiler, "javac <my sourcefile>", which is included in the JDK.
  3. Fix Syntax Errors If there were errors in your source files that keep the compiler from compiling your program (these type of errors are called "syntax errors"), re-edit the source files to eliminate them and then recompile. If there were no such errors, then a Java bytecode file will be produced (i.e., a file with a "*.class" extension).
  4. Run Bytecode The java bytecode file is a set of instructions that can be executed by the Java Virtual Machine (JVM). To run the JVM, one can type "java <my classfile>" from the command line. This runs the program.
  5. Fix Runtime and Logical Errors There might still be errors present in your program, despite the fact that it compiled.