What Is Java?


When you hear people refer to Java, they often mean the Java language. The Java language allows you to write instructions, or code, that your computer will interpret in order to execute a software application, or program. Examples of applications are Microsoft Word, Netscape, and the little clock that runs in the corner of your monitor. Coding, or programming, is the act of writing programs.

Another thing people mean when they refer to Java is the Java platform. The term platform usually indicates an underlying operating system, such as Windows or Unix™, on which you can run applications.[1] Java acts as a platform: It not only defines a language but also gives you a complete environment in which to build and execute your programs. The Java platform acts as a layer between your application and the underlying operating system; it is a minioperating system in itself. This allows you to write code in a single language and execute it on virtually all major operating systems today.

[1] [WhatIs2004].

You will download the Java software development kit (SDK), which provides you with three main components:

  • a compiler (javac)

  • a virtual machine, or VM (java)

  • a class library, or API (application programming interface)

The compiler is a program that reads Java source files, ensures they contain valid Java code, and produces class files. A source file is a text file that contains the code you type. The class files you generate using the compiler contain byte codes that represent the code you typed in. Byte codes appear in a format that the VM can rapidly read and interpret.

The VM (or JVMJava virtual machine) is a program that executes the code within your class files. The term "virtual machine" derives from the fact that it acts as if it were a complete platform, or operating system, from the standpoint of your Java programs. Your code does not make direct calls to the operating system application programming interface (API), as it might if you were programming directly for Windows in a language such as C or C++.

The Numbers Game

The history of Java contains a handful of significant releases. The first public release of Java (in 1996) was known as Java 1.0. Versions 1.1, 1.2, 1.3, and 1.4 followed, separated by roughly one year each. As of version 1.2, Sun renamed the platform from simply Java to Java 2. With the latest release, Sun chose to embark upon a new numbering scheme, presumably to impart the significance of the release. The version you will learn in this book is formally known as Java 2 Standard Edition 5.0. I will use the abbreviated name J2SE 5.0 throughout the book.


Instead, you write code only in the Java language and use only a set of libraries, known as class libraries, or APIs, provided as part of the Java SDK. You might see references to the VM as an interpreter, since that is its chief responsibility: The VM interprets the needs of your code and dispatches these needs to the underlying operating system as necessary. The VM is also responsible for allocating and controlling any memory that your code needs.

Java is known as an object-oriented programming language. The basic premise of an object-oriented programming language is that you can create abstractions of real-world things, or objects, in code. For example, you can create a Java code representation of a calculator that emulates some of the characteristics and behavior of a real-world calculator.

If you have never programmed before, you are in luck: Object-oriented (OO) programming is much easier to learn from scratch than if you have already learned a non-OO programming language like Cobol or C. If you have been tainted by a procedural or declarative language, you may want to read this chapter a few times. Expect that learning OO is not easy; expect to spend a few months before the light bulb in your head stays on all the time without blinking.

This chapter explains the basics of object orientation. Conceptually, OO is reasonably straightforward, but it can take some time for the ideas to sink in, particularly without concrete code examples. Hence, this chapter is brief; instead, you will learn the bulk of OO as you learn to code in Java.



Agile Java. Crafting Code with Test-Driven Development
Agile Javaв„ў: Crafting Code with Test-Driven Development
ISBN: 0131482394
EAN: 2147483647
Year: 2003
Pages: 391
Authors: Jeff Langr

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net