What is JAVA?
Sun Microsystems has composed a comprehensive definition of Java in a white paper entitled: The Java Language, an Overview. It states:
Java is a simple, object-oriented, network-savvy, interpreted, robust, secure, architecture-neutral, portable, high-performance, multithreaded, dynamic programming language.
But what is it really? Java Technology is both a programming language and a platform. The three key words in the definition above are: simple, interpreted, and architecture-neutral. Thus, Java is a simple interpreted programming language capable of executing Java programs on any computer system running the Java Virtual Machine (JVM – the Java platform).
Java is simple. The designers at Sun purposely designed the Java language and Application Program Interface (API) to be easy to learn and easy to use. The API is part of the JVM and is a set of core Java classes that you may call upon at anytime in your program. Classes are Java’s name for programs, methods or procedures. The syntax of the Java language is based on the C programming language. Because many programmers are experienced in C, Java can be very easy to learn.
Java is interpreted. The Java platform compiler translates Java source code into what is know as bytecode. Bytecode is similar to the executable code found after compiling or assembling source code designed for a specific processor except that bytecode is architecturally neutral. The JVM (Java Virtual Machine) is required to interpret the bytecode and direct the local system hardware to execute the instructions in its native machine code.
|
|
|
Because Java is interpreted, any computer system with the Java Virtual Machine (JVM) installed is capable of executing the Java Program. Thus, Java is portable and architecture-neutral. Web browsers today are Java enabled or capable of executing small Java programs called applets. Therefore, your web browser enables the JVM on your computer system.
|
|
|
Many of the object-oriented concepts are the same as in C++ and are implemented with similar constructs. The most error-prone, complex, and difficult to understand constructs in C and C++ were operations with and on pointers. Sun eliminated this complexity in the Java programming language by not including operations with and on pointers. The JVM handles memory allocation and deallocation automatically, thereby simplifying many programming tasks. Seasoned C++ programmers will testify that Java is a simpler programming language because some of the more complex constructs, such as overloaded operators and pointers, have no equivalent in Java.
Java is evolving. The original Java (Java 1.0) platform contained approximately 200 core classes. This increased to about 500 core classes in Java 1.1 and about 1600 in Java 2 (the current Java platform). Java is a powerful, dynamic programming language.
Java is network-savvy in the sense that the current API includes a package called java.net. Java.net is a set of core classes and tools that address network programming concerns such as: user identification, security, authorized access, and data transfer integrity.
Java is robust and reliable. The JVM ensures that programs execute correctly and, in the event that the unexpected happens, do not “crash and burn”. One of the ways that the JVM ensures correct execution is that it will not allow your program to directly access system resources. To access system resources, your program must go through the API. Your program cannot
1) Access memory that applications are not allowed to make use of,
2) Call system APIs improperly, or
3) Perform operations that can cause errors.
The JVM does this by performing both compile-time and run-time error checking. The JVM includes error-handling procedures so that, if an error occurs during program execution an exception is generated. An exception includes information such as what type of exception occurred and the source of the problem. If exception-handling methods are included in your program, you can intercept these exceptions and take the appropriate action.
Java is secure. Java is designed to operate in a distributed environment (a network environment) where security is extremely important. Security features in both the JVM and the Java language prevents your program from being “invaded” from the outside and also prevents your program from invading system space. This is because all java programs must execute from within the JVM.
|
|
|
By default, all local programming is considered “safe” or trusted. Remote code is not trusted. Any remote programs (Java applets for example) are executed in a separate memory area called the “sandbox”. The sandbox has limited privileges so the JVM will not allow un-trusted programs to perform such activities as writing to local disk drives, directly accessing native program code, or reading certain system parameters.
As a platform-independent environment (interpreted bytecodes), the Java platform can be a bit slower than native code (programs written and compiled for a specific machine). This is a trade-off with portability. However, smart compilers, well-tuned interpreters, and just-in-time (JIT) bytecode compilers can bring performance close to that of native code without threatening portability (high-performance). You can compile source code to platform specific executable code, thereby skipping the need for an interpreter to increase the performance of your program on the local machine, but, if you do this, your program will no longer be portable.
Java is multithreaded. Modern network-based programs typically require that many tasks be performed simultaneously (multithreading). Java’s multithreading capabilities easily allow programmers to generate code that will create, launch, and synchronize threads.
Java is dynamic. The JVM does not require that all classes used by a program be loaded prior to program execution. This improves execution time and performance. Any class that is needed during program execution is loaded as needed by the JVM.
For more on this topic read The Java Language Environment (May 1996), a White Paper written by James Gosling and Henry McGilton.
Send comments to: SJKuyath@uncc.edu
Copyright Stephen J Kuyath, UNC-Charlotte
last modified: January 12, 2002