
Summary
Java is two things: a programming language and a platform.
There are two components to the Java platform:
• The Java Virtual Machine (JVM)
• The Java Application Programming Interface (API)
The Java API is a large collection of ready-made software components that provide many useful capabilities.
The Java Virtual Machine (JVM) insulates your application from platform specifics.
In Java, applications are both compiled and interpreted.
• The Java compiler compiles your application source code to an intermediate language called
bytecode, which the JVM interprets.
• JVMs are built specific to a particular platform (hardware and OS).
There are three editions and many versions of Java.
• The Java Standard Edition (Java SE) is primarily for desktop-based applications.
• Java EE provides everything in Java SE and a host of additional Java components (API) for
developing server-based applications.
• Java Micro Edition (Java ME) is Java for consumer electronics and embedded devices that
have limited power, memory, and connectivity.
• The latest version of Java SE is 6.
Javac.exe is the Java compiler that turns your Java source code to bytecode files called class files. When
running java.exe, you are actually running the Java Virtual Machine.
Java is an object-oriented programming language.
Object-oriented programming represents a way of creating code that mimics real-world entities or “objects.”
• The result of mimicking the real world is code that more aptly matches the problem the
programmer is trying to solve.
• This process of writing code to be like the real world is called abstraction.
Objects are software bundles of data and related procedures (also called methods). In Java, there are eight
primitive data types: byte, short, int, long, float, double, boolean, and char. Everything else in Java is an
object!
The “new” keyword creates an object (called an instance) of the object type. With a Java object, you call on
its functionality in methods using the dot notation.
Objects also contain data. In Java, data is contained in instance variables.
• Object data can be initialized through a constructor.
• A constructor is a special Java method named the same as the class.
A class defines what data objects of that type can store and what functions they can perform.
• A class is a template for object creation.
• An object is called an instance of a class.
• Many object instances can be generated from one class.
The Default constructor is a no-arguments constructor provided by Java if you define a class without
explicitly defining any constructors.
• The Default constructor allows you to create objects of classes that have no specifically
designed constructors.
• The Default constructor does not exist when the class contains any other constructor.
Classes are templates for object creation, or a user-defined type. An object is an instantiation of a class,
something concrete created using a class template. Java allows you to tie variables not only to each object but
to the class.
Data associated with the class instead of the object is stored in class variables (versus instance variables for
objects or instances).
• Class variables are also called static variables.
• They are called static variables because the static keyword is used to identify them.
• Class variables are global — only one exists in memory per class.
The static keyword can also be applied to a method. A static method, like a static variable, is associated with
the class, not the objects (instances).
• Static methods are also called class methods (versus nonstatic methods, which are instance
methods).
• Static methods essentially have two purposes: to access (update or fetch) class variable data
and to provide functionality without the need for an instance.
The “this” keyword has two uses: to refer to the current instance and to refer to or call on another
constructor (chain constructors) for code reuse.
There are several levels of scope: instance variables, static variables, and local variables. Scope is typically
defined by code block.
• Any variables defined in a given code block only live within that section of code or scope.
The Java runtime environment manages memory for you.
• You never have to destroy an object explicitly or manage the memory it uses.
• The Java runtime environment deletes objects when it determines that they are no longer
being used. This process is known as garbage collection.
Java Tutorial Summary
Table of Contents
Copyright (c) 2008. Intertech, Inc. All Rights Reserved. This information is to be used exclusively as an
online learning aid. Any attempts to copy, reproduce, or use for training is strictly prohibited.
Courseware
Training Resources
Tutorials
Services