Sei sulla pagina 1di 3

The Java Language

Chapter 2
The Java Language

Java technology is both a programming language and a


platform.

The Java Programming Language


The Java programming language is a high-level language, has taken many best
features from languages like Ada, Smalltalk, C and CPP. Java is indebted to C and CPP to
its syntax. Java can be characterized by all of the following buzzwords:
Simple Architecture neutral
Object oriented Portable
Distributed High performance
Multithreaded Robust
Dynamic Secure
Visit http://java.sun.com/docs/white/langenv/ to get the explanation of buzzword.

Java technology distributed mainly in three flavors

• JAVA SE
• JAVA EE
• JAVA ME

Java development environment

Installation of JAVA SE in windows creates the following directory structure

JAVA_HOME

BIN LIB ……. INCLUDE

JAVA_HOME is referred to the absolute path to parent directory of its content.


For example, D:\Program Files\Java\jdk1.5.0_05
For the proper compilation and execution of java program requires setting up of
ENVIRONMENT variables. The following are required environment variables:
JAVA_HOME
The Java Language

It contains absolute path to java SE installation for e.g. D:\Program


Files\Java\jdk1.5.0_05
CLASSPATH
It contains absolute path to LIB and your working directory, for e.g.
%JAVA_HOME%\LIB;D:\javaapp
PATH
It contains absolute path to BIN, for e.g. %JAVA_HOME%\BIN;

Frequently using java tools


All the tools required for compiling, debugging and executing java programs
resides in BIN directory. Bin directory consists of several types of compiler besides
standard compiler javac

Why java so important


Get started quickly: Although the Java programming language is a powerful
object-oriented language, it's easy to learn, especially for programmers already familiar
with C or C++.

Write less code: Comparisons of program metrics (class counts, method counts,
and so on) suggest that a program written in the Java programming language can be four
times smaller than the same program written in C++.

Write better code: The Java programming language encourages good coding
practices, and automatic garbage collection helps you avoid memory leaks. Its object
orientation, its JavaBeans component architecture, and its wide-ranging, easily
TM

extendible API let you reuse existing, tested code and introduce fewer bugs.

Develop programs more quickly: The Java programming language is simpler


than C++, and as such, your development time could be up to twice as fast when writing
in it. Your programs will also require fewer lines of code.

Avoid platform dependencies: You can keep your program portable by avoiding
the use of libraries written in other languages.

Write once, run anywhere: Because applications written in the Java


programming language are compiled into machine-independent bytecodes, they run
consistently on any Java platform.
The Java Language

Coding standard
Java suggests set of coding standard to follow while writing java program. Coding
standard helps author as well as others to better understand program. It reduce amount of
debugging time considerably. Basically coding standard suggests how to name class,
methods variables of different scope, package etc.
Writing a Java program
In the Java programming language, all source code is first written in plain text
files ending with the .java extension. Those source files are then compiled into .class files
by the javac compiler. A .class file does not contain code that is native to your processor;
it instead contains bytecodes — the machine language of the Java Virtual Machine1 (Java
VM). The java launcher tool then runs your application with an instance of the Java
Virtual Machine.

Potrebbero piacerti anche