Java is both a programming language and a platform.
Java the programming language
As a programming language Java was designed to:
-
be Simple
-
Easy to program without heavy training and similar to existing languages
so that developers could move to the new language easily. This is the reason
that Java source code bears a strong resemblance to C and C++.
-
be Object oriented
-
A object based language provides better ways of modularizing and reusing
code then non-object oriented languages.
-
be Network-savvy
-
With the explosion of the web and the move to distributed systems a language
without network support is severely crippled.
-
be Robust
-
Java is a strongly typed language and performs several types of checking
to avoid common problems in systems. It also eliminates pointer arithmetic
and operations. This avoids memory leaks, stray pointers and bad pointers
causing application crashes.
-
be Secure
-
Because Java is intended for use in networked and distributed environments,
several layers of security exist in the run-time environment. These include
validation of the compiled code before it is executed and a security model
that can control how much of the systems resources an application can access.
-
be Architecture neutral
-
The Java compilers produce compiled byte code that is platform independent.
This means that compiled code will run on any platform that supports Java,
regardless of the systems CPU and operating system.
-
be Portable
-
To ensure portability across different platforms, Java removes any "implementation
dependent" behaviour. For instance the sizes of the primitive data types
are specified, as is the behavior of arithmetic on them. For example, "int"
always means a signed two's complement 32 bit integer, and "float" always
means a 32-bit IEEE 754 floating point number.
-
have High-performance
-
Although Java byte code is interpreted, it was designed to be easily compiled
to into native machine code on the fly. This compiled code performs at
speeds near to C and C++. This kind of compilation is called just-in-time
(JIT) compilation and is completely hidden away from the developer.
-
be Multithreaded
-
Multithreading allows an application to perform many actions at once and
allows for more complex software to be built. However the development of
multithreaded applications is much harder and error prone. Java provides
a simple yet powerful model that eases the development of multithreaded
applications.
-
be Dynamic
-
Java is highly dynamic and provides mechanisms for collecting runtime
type information. These features make the language very flexible.
Java the Platform
The Java platform is a software only environment that runs on top of hardware
based platforms. Java applications run within the Java platform. The Java
platform consists of two components:
-
The Java Virtual Machine (Java VM)
-
The Java Application Programming Interface (Java API)
The Java Virtual Machine
The Java VM is a application that can interpret Java byte code. It forms
the base of the Java platform and is ported to run on various hardware
platforms or environments. For instance a Java VM can be included in an
OS like Windows, embedded into a Cell phone or be included in a web browser.
Each of these cases allow Java applications to run in the particular environment.
The Java Application Programming Interface
The Java API is a large collection of ready-made software components. These
components include GUI components, IO components, utility components, text
formatting components and networking components. These components are grouped
into libraries (called Packages) of related components.
Platform Independence vs Performance
Java is a platform independent environment, as such it can be slower then
native code. However smart compilers and interpreters combined with just-in-time
(JIT) compilation brings Java's performance close to that of native code
without losing any portability.
Sources: