Java is a platform-independent programming language used to create a secure and robust application that may run on a single computer or may be distributed among servers and clients over a network.
Java features such as platform-independent and portability ensure that while developing Java EE enterprise applications, you do not face the problems related to hardware, network, and the operating system.
History of Java:
Java was started as a project called "Oak" by James Gosling in June 1991. Gosling's goals were to implement a virtual machine and a language that had a familiar C like notation but with greater uniformity and simplicity than C/C++.
The First publication of Java 1.0 was released by Sun Microsystems in 1995. It made the promise of "Write Once, Run Anywhere", with free runtimes on popular platforms.
In 2006-2007 Sun released Java as open source and platform independent software.
Over time new enhanced versions of Java have been released. The current version of Java is Java 1.8 which is also known as Java 8.
Java Virtual Machine and Java Runtime Environment:
The Java virtual machine (JVM) is a software implementation of a computer that executes programs like a real machine.
The Java virtual machine is written specifically for a specific operating system, e.g. for Linux, a special implementation is required as well as for Windows.
Java programs are compiled by the Java compiler into bytecode. The Java virtual machine interprets this bytecode and executes the Java program.
The Java runtime environment (JRE) consists of the JVM and the Java class libraries and contains the necessary functionality to start Java programs.
The JDK contains, in addition, the development tools necessary to create Java programs. The JDK consists therefore of a Java compiler, the Java virtual machine, and the Java class libraries.
Features of Java:
The characteristics and features of Java are as follows:
Java is a simple language because of its various features, Java does not support Pointers, Operator Overloading etc. It does not require unreferenced object because of java support automatic garbage collection.
Java provides bug-free system due to the strong memory management.
Object-Oriented Programming Language (OOPs) is the methodology which provides software development and maintenance by using object state, behavior, and properties.
Object-Oriented Programming Language must have the following characteristics.
As the languages like Objective C, C++ fulfills the above four characteristics yet they are not fully object-oriented languages because they are structured as well as object-oriented languages.
In Java, everything is an Object. Java can be easily extended since it is based on the Object model
Java is Secure Language because of its many features it enables to develop virus-free, tamper-free systems. Authentication techniques are based on public-key encryption. Java does not support pointer explicitly for the memory.
All Program Run under the sandbox.
Java was created as a strongly typed language. Data type issues and problems are resolved at compile-time, and implicit casts of a variable from one type to another are not allowed.
Memory management has been simplified java in two ways. First Java does not support direct pointer manipulation or arithmetic. This makes it possible for a java program to overwrite memory or corrupt data.
Second, Java uses runtime garbage collection instead of instead of freeing of memory. In languages like c++, it Is necessary to delete or free memory once the program has finished with it.
Java Language is platform-independent due to its hardware and software environment. Java code can be run on multiple platforms e.g. Windows, Linux, Sun Solaris, Mac/Os etc. Java code is compiled by the compiler and converted into bytecode. This bytecode is a platform independent code because it can be run on multiple platforms i.e. Write Once and Run Anywhere(WORA).
It is not easy to write an application that can be used on Windows, UNIX, and a Macintosh. And it's getting more complicated with the move of windows to non-Intel CPU architectures.
Java takes a different approach. Because the Java compiler creates bytecode instructions that are subsequently interpreted by the Java interpreter, architecture neutrality is achieved in the implementation of the Java interpreter for each new architecture.
Java code is portable. It was an important design goal of Java that it be portable so that as new architectures(due to hardware, operating system, or both) are developed, the Java environment could be ported to them.
In Java, all primitive types(integers, longs, floats, doubles, and so on) are of defined sizes, regardless of the machine or operating system on which the program is run. This is in direct contrast to languages like C and C++ that leave the sized of primitive types up to the compiler and developer.
Additionally, Java is portable because the compiler itself is written in Java.
Because it is interpreted, Java is an extremely dynamic language, At runtime, the Java environment can extend itself by linking in classes that may be located on remote servers on a network(for example, the internet)
At runtime, the java interpreter performs name resolution while linking in the necessary classes. The Java interpreter is also responsible for determining the placement of an object in memory. These two features of the Java interpreter solve the problem of changing the definition of a class used by other classes.
We all know that Java is an interpreted language as well. With an interpreted language such as Java, programs run directly from the source code.
The interpreter program reads the source code and translates it on the fly into computations. Thus, Java as an interpreted language depends on an interpreter program.
The versatility of being platform independent makes Java outshine from other languages. The source code to be written and distributed is platform independent.
Another advantage of Java as an interpreted language is its error debugging quality. Due to this any error occurring in the program gets traced. This is how it is different to work with Java.
For all but the simplest or most infrequently used applications, performance is always a consideration for most applications, including graphics-intensive ones such as are commonly found on the world wide web, the performance of Java is more than adequate.
Writing a computer program that only does a single thing at a time is an artificial constraint that we have lived within most programming languages. With Java, we no longer have to live with this limitation. Support for multiple, synchronized threads is built directly into the Java language and runtime environment.
Synchronized threads are extremely useful in creating distributed, network-aware applications. Such as application may be communicating with a remote server in one thread while interacting with a user in a different thread.
Java facilitates the building of distributed application by a collection of classes for use in networked applications. By using java URL (Uniform Resource Locator) class, an application can easily access a remote server. Classes also are provided for establishing socket-level connections.