Reason for developing Java Programming Language
The Java technology was designed by Gosling, with the main goal of eliminating the need to create and distribute different versions of the software programs for different operating system and hardware platforms. To accomplish this goal, the Java technology is specifically designed to give developers the ability to build software applications that can run on multiple platforms.
Components of Java Programming Language
According to Gosling, there are certain aspects to Java language:
1. Java programming language has a set of Java APIs found in the Java class libraries, which include standard modules of preconfigured software code that ease software development for Java
2. There is a Java compiler, which translates Java-based sourcecode into Java-based bytecode (so that it can be understood by the JVM)
3. Java Virtual Machine is part of a "Java runtime environment" on the user's computer, that consists of not only the JVM, but also a set of the Java class libraries that are used by a Java-based program running on the JVM. The JVM and the Java class libraries must both be on a user's computer in order to run Java code. The term JVM is sometimes used to refer to the entire Java runtime environment.
Java-based programs interact with a Java virtual machine or JVM, which is an intermediate software layer that translates the Java-based program for the particular operating system and hardware platform that the Java virtual machine runs on. Java-based program views the JVM as an operating system, and the operating system views the JVM as a traditional application.
Gosling views Java as "Simple, OO, distributed, interpreted, robust, secure, architecture neutral, portable, high-performance, multithreaded, dynamic programming language".
Let's try to understand the different aspects of Gosling's definition of Java language.
Java is a simple language that can be programmed without extensive programmer training. The basic concepts of Java technology are easier to understand. Java and C++ are object-oriented languages, which have some differences like C++ supports the concept of templates, automatic coercion and multiple inheritance, whereas Java does not support these concepts. In Java multiple inheritance is attained through interfaces.
Java supports OO paradigm. It supports objects with dynamic method resolution. To function within increasingly complex, network-based environments, programming systems must adopt object-oriented concepts. Java technology provides a clean and efficient object-based development platform.
Robust and Secure
Java is a robust language. The memory management model is extremely simple: objects are created with a new operator. There are no explicit programmer-defined pointer data types, no pointer arithmetic, and automatic garbage collection.
The Java programming language provides secure software. It provides extensive compile-time checking, followed by a second level of run-time checking. With security features designed into the language and run-time system, Java technology lets you construct applications that can't be invaded from outside. In the network environment, applications written in the Java programming language are secure from intrusion by unauthorized code attempting to get behind the scenes and create viruses or invade file systems.
Java technology is designed to operate in distributed environments, which means that security is very important.
Architecture Neutral and Portable
Java technology is designed to support applications that are deployed into different types of network environments. In such environments, applications must be capable of executing on a variety of hardware architectures. Within this variety of hardware platforms, applications must execute atop a variety of operating systems and interoperate with multiple programming language interfaces. To accommodate the diversity of operating environments, the Java Compiler generates bytecodes--an architecture neutral intermediate format designed to transport code efficiently to multiple hardware and software platforms.
Architecture neutrality is just one part of a portable system. Your programs are the same on every platform--there are no data type incompatibilities across hardware and software architectures. This is achieved by Java virtual machine, described above.
The automatic garbage collector runs as a low-priority background thread, ensuring a high probability that memory is available when required, leading to better performance. Applications requiring large amounts of computing power can be designed such that compute-intensive sections can be rewritten in native machine code as required and interfaced with the Java platform. In general, users perceive that interactive applications respond quickly even though they're interpreted.
Java provides monitors support. It also supports the concept of multithreading through certain API's. Java technology's multithreading capability provides the means to build applications with many concurrent threads of activity. Multithreading thus results in a high degree of interactivity for the end user. Java technology's high-level system libraries have been written to be thread safe: the functionality provided by the libraries is available without conflict to multiple concurrent threads of execution.
While the Java Compiler is strict in its compile-time static checking, the language and run-time system are dynamic in their linking stages. Classes are linked only as needed.