This tutorial explains the installation and usage of the Java programming language. It also contains examples for standard programming tasks.
1. Introduction to Java
Java is a programming language created by James Gosling from Sun Microsystems in 1991. The first publicly available version of Java (Java 1.0) was released in 1995.
Over time new enhanced versions of Java have been released. The current version of Java is Java 1.7 which is also known as Java 7.
From the Java programming language the Java platform evolved. The Java platform allows that the program code is written in other languages than the Java programming language and still runs on the Java virtual machine.
1.2. Java Virtual machine
The Java virtual machine (JVM) is a software implementation of a computer that executes programs like a real machine.
The Java virtual machine is written specifically for a specific operating system, e.g. for Linux a special implementation is required as well as for Windows.
Java programs are compiled by the Java compiler into so-called bytecode. The Java virtual machine interprets this bytecode and executes the Java program.
1.3. Java Runtime Environment vs. Java Development Kit
Java comes in two flavors, the Java Runtime Environment (JRE) and the Java Development Kit (JDK).
The Java runtime environment (JRE) consists of the JVM and the Java class libraries and contains the necessary functionality to start Java programs.
The JDK contains in addition the development tools necessary to create Java programs. The JDK consists therefore of a Java compiler, the Java virtual machine, and the Java class libraries.
1.4. Characteristics of Java
The target of Java is to write a program once and then run this program on multiple operating systems.
Java has the following properties:
Platform independent: Java programs use the Java…...