Object-oriented. Just like C++, Java uses classes to organize code into logical
modules. At runtime, a program creates objects from the classes. Java classes can
inherit from other classes, but multiple inheritance, wherein a class inherits methods
and fields from more than one class, is not allowed.
Statically typed - All objects used in a program must be declared before they are
used. This enables the Java compiler to locate and report type conflicts.
Compiled - Before you can run a program written in the Java language, the program
must be compiled by the Java compiler. The compilation results in a "byte-code" file
that, while similar to a machine-code file, can be executed under any operating system
that has a Java interpreter. This interpreter reads in the byte-code file and translates the
byte-code commands into machine-language commands that can be directly executed
by the machine that's running the Java program. You could say, then, that Java is both a
compiled and interpreted language.
Multi-threaded - Java programs can contain multiple threads of execution, which
enables programs to handle several tasks concurrently. For example, a multi-threaded
program can render an image on the screen in one thread while continuing to accept
keyboard input from the user in the main thread. All applications have at least one
thread, which represents the program's main path of execution.
Garbage collector - Java programs do their own garbage collection, which means
that programs are not required to delete objects that they allocate in memory. This
relieves programmers of virtually all memory-management problems.
Robust - Because the Java interpreter checks all system access performed within a
program, Java programs cannot crash the system. Instead, when a serious error is
discovered, Java programs create an exception. This exception can be captured and
managed by the program without any risk of bringing down the system.
Secure - The Java system not only verifies all memory access but also ensures that no
viruses are hitching a ride with a running applet. Because pointers are not supported by
the Java language, programs cannot gain access to areas of the system for which they
have no authorization.
Extensible - Java programs support native methods, which are functions written in
another language, usually C++. Support for native methods enables programmers to
write functions that may execute faster than the equivalent functions written in Java.
Native methods are dynamically linked to the Java program; that is, they are associated
with the program at runtime. As the Java language is further refined for speed, native
methods will probably be unnecessary.
Compiled by Umesh Sharma