Java means ?

Java means a programming language. Then, what is programming language? It means, a language used to interact between Humans and Machines.

There are many Programming language paradigms are there, namely Procedural language, Object Oriented Programming language, Functional language and more. Here Paradigm means, a set of Concepts & Patterns. By keeping Paradigm as a base, every Programming language has been developed.

Most of the Programming languages are based on Object Oriented Programming language. Of Course, C is one of the lime light language which is based on Procedural language. However, C++, Java, Ruby, etc are more famous which are based on Object Oriented Programming language. This is because, the way of handling the data, the structure and the maintenance of each paradigm differs and the OOP satisfies everything.

OOP concept has been sparked around 1960s while developing a Ship Simulator. Post that many languages developed based on OOP.

Now will get into the topic, Java.

Why?

It simply helps Human to communicate with Machine (which can understand 0s & 1s). Since, it’s developer friendly, many developers will prefer Java.

Where?

We can use Java anywhere, it can be used to develop a chat application, a business software application, a mobile application, a website, a surgical equipment, home appliances etc.

Java contains two major parts:

1) JDK – Java Development Kit

  • JDK contains Development tools, Monitoring tools and JRE. These will convert user read/write Java Code into Java’s understandable Code

2) JRE – Java Runtime Environment

  • JRE contains JVM (Java Virtual Machine) and some library files which will convert the Java’s understandable code into Machine Understandable Code.

While installing the JAVA, it will ask which one to download (JDK or JRE) or both. If you are going to develop Java application, then install JDK & JRE. If you going to use Java application, then JRE is enough.

Then you may have this doubt, if any website uses Java, then to view the webpage, whether we need to install JRE? – No, java is a server side programming language, so it will use server’s JRE and return the response to your browser. Some exceptional cases are there, we can skip that.

Java workflow:

Before knowing about the Java workflow, have to know some general term about Compiler and Interpreter.

Compiler means, it will read our whole code at a single shot and convert it into Machine Language. If some line of our code contains error, it will note it and once read all the lines of code, it will show exception for those error lines.

Interpreter means, unlike the Compiler, it won’t read the whole code at a single shot, it will read line by line. It will read the first line of our code, it verifies, if there is no error, then it will read the next line , once fully verified then convert it to Machine Language. Like wise, it repeats. If any error occurs, it stop the execution there itself and throws exception.

Below is the Java workflow:

In Java, Compiler will convert our Java code into Java understandable code know as ByteCode or .Class file. Unlike, C or C++, here compiler won’t convert directly to Machine Language. After compiles, it will generate a .CLASS file which contains Java understandable code(humans can’t able to understand). JRE refers this .CLASS file only.

Class Loader which is present inside the JVM, will load the class file available in rt.jar (it’s java product jar, do not change anything) and our .CLASS files from the secondary memory into RAM. Once the class files loaded, then those will be verified and initialized, then the flow will come to JIT compiler where it will check for any reusable code available. Then the flow will reach the Interpreter which will interacts with native component and returns the expected output.

Whenever runs the java code, main() method will the starting point, from there all the sequential methods will executes. These will execute all the methos in sequential manner, where the first method completes, then the second method starts to execute. To achieve this hierarchy, java uses the Stack data structure which follows the FILO (First In Last Out).

Inside this stack, all the the local variable of the method will be stored. Here objects will be stored in the Heap memory and its address will be stored under its variable in the stack. While coding, whenever we are using the new keyword, new object will be created in the Heap.

The term thread means a sequence of program which means, a single flow of program running in a single stack. If we needs to run multiple programs in parallel to the main thread, then those programs can be run in the separate stacks and this concept is named as multithreading. However stack can be multiple but Heap will be single, which means all those stack will utilize and stores the object in a single Heap memory.

Java in market:

Java occupies the predominant place in programming language. On each and every Version release, they are making the language much easier. As a sample in Java 1.7, they introduced the try with resource concept, in Java 8, they introduced the lambda expression where functional language has been used and many more.

Currently, most of the IT company uses the Java 8 and some company migrating to latest version Java 11 or even latest. By keeping Java as a base, many other frameworks have been developed and using widely in the market like Spring which will makes the developers life much more easier.

At this point, hope, readers of this post have gained some basic knowledge of the Java. Its not explained in much more technical but have explained in high level to get a grasp.