Do you want to know how java work on hardware, how the magic of java works read this article this is a short one but explain well the way java works.
The java has its biggest base in the Byte code. Now what is Byte code ?
Its an intermediate code which runs on the JVM, the java virtual machine.
The Java program is compiled using the java compiler and a “.class” file is produced. This class file contains the java bytecode. And the bytecode is common to all the machine and is an unreadable code to humans. Even if you open this in a text editor and try to modify it. This will not work. You will have to recompile this.
The diagram above shows the basic working of the bytecode.
Features of Java
Java language is probably the most popular language used in programming after the c/c++. There are several reasons and features in this language which defines its popularity among the developers as well as users who are using the software or web applications, developed in java.
Lets have a look at these features at a glance.
- Platform independent
- Architecture neutral
- High Performance
Let us now brief these point somewhat:
1. Simple: All the programmers who have worked in c or c++ will find the basic construct and syntax similar to these languages. This makes the Java simple.
2. Object Oriented: The Java is known to be pure OOP language. That means it uses the Class and object scenario. Those who are familiar with OOP knows its a good practice and makes it easy to map real life problem into the programming paradigm.
3. Platform Independent: The life concept of java was platform independence. That mean Once you write and compile the code you don’t need to recompile it for another platform. Java produces the Bytecode on compiling which is runnable on any platform having the JRE(Java Runtime Environment) installed. JRE is an interpreter for the java bytecode.
4. Secure: The Security of the Java comes from its structure. The web application which runs on the CGI scripts are prone to injections of malicious code but in Java there is not threat of this as the code is already compiled. And even if one try to make changes in the class file(byte code) that file is corrupted and needs to be compiled again. Beside that the Java code in free from the virus threat.
5. Robust: The Java is strictly typed language and hence does not allows any type of error to pass through compiler. The strictly typed means that it take cares of the internal data type casting and conversion. You can not store wrong data type in some variable. Even Java forces you to take precautions to the code which looks right at compile time and may produce error at runtime, these are called caught exceptions.
6. Architecture Neutral: The Java is architecture Neutral because the size of data type is auto maintained by the JVM and you don't need to care how the primitive types will behave on 32 bit or 64 bit system or whatever the hardware configuration be.
7. Portable: The compiled code of Java or the executable file created in Java can be run on any platform and is completely portable.
8. High Performance: Even after being a high level language Java's native code is real close to hardware. So its performance is quite appreciable. However if you compare it to the c or c++ its a bit slower but with the scalability and features Java gives its real affordable.
9. Distributed: The Java have a huge support for the lower level protocols too. Which makes it easier to make the remote calls and run the applications on distributed systems.
10. Multi-Threaded: The thread is a smaller part of program which can run as a unity. Java support the multi-threaded system in which you can define your own thread and control the system.
11. Huge API support: The Java provide a large number of APIs, which can allow you to do almost everything in Java. The Java community is a large community so even if you stuck you can easily find help.
Official java Docs