Introduction to JAVA Programming Language
JAVA is a purely object-oriented programming language developed by Sun Microsystems of USA in 1991. It is a general-purpose, multiplatform, class-based, object-oriented programming language that is designed for having lesser implementation dependencies. It is the fastest, most secure, and most popular programming languages preferred by different organizations to build their projects.
It was originally called OAK by James Gosling. It means the JAVA platform was developed by James Gosling at Sun Microsystem in 1991 and later in 2009 Oracle Corporation acquire Sun Microsystem and took ownership.
How does JAVA work?
JAVA is compiled into the bytecode and then it is interpreted for the machine code.
The first step is that we need a java source code that contains some meaningful sense otherwise we won’t be able to run that program and then we need to save it with the class name and with the ‘.java’ extension. Ex:- ‘class.java’.
The second step is that we need a compiler to compile the source code which turns it and gives out a java bytecode and that bytecode file has a ‘.class’ extension. The Java bytecode is a redesigned version of the java source codes so this bytecode can run anywhere in any system irrespective of the machine on which it has been built.
And then we put that bytecode in the Java Virtual Machine which is an interpreter that reads all the statements step by step thoroughly from that bytecode which will again be converted into the machine-level language so that the machine can understand & execute the code easily. And then we get the output.
Why use JAVA?
- Java is platform-independent so that the java program can run on any system (Windows, Mac, Linux, Raspberry Pi, and many more.)
- It is one of the easy-to-learn programming languages
- It is one of the most popular and demanded programming languages.
- It is an open-source and free platform.
- Its programs allow code to be reused.
- It is secure, fast, and powerful
- It is likely to close C++ and C#.
- It is Portable.
Terminology of JAVA
Moving towards terminology there are some important Java terms that we need to understand. So let’s have a depth understanding of java terminology.
Java Development Kit(JDK)
Java Development Kit(JDK) is a key platform component for building Java applications. It offers a different collection of tools and libraries that are necessary for developing Java-based software applications and applets. It is one of the three core technology packages which is used in the Java programming language, along with the Java Virtual Machine(JVM) and the Java Runtime Environment(JRE).
Java Run-time Environment(JRE)
Let me clear that here JDK includes JRE. After installation, it allows the java program to run smoothly. But we still couldn’t compile it. Because it has a browser, the applet supports, and a few more plugins included in it. So that to run a java program on your computers you need JRE. So now the JRE is made up of multiple elements and they are:
- Java virtual machine (JVM)
- Java class libraries
- Java class loader
When a system is ready to execute a program, it requires some environment to run. It is applicable to any operating system, like Microsoft Windows, Linux, Unix, macOS, etc. So the JRE here acts as a translater and converter between the java program and the operating system.
Java Virtual Machine(JVM)
A Java virtual machine (JVM) is a virtual machine. It enables a computer to run Java programs and it also helps in compiling to bytecode. Whenever we run a java program using the JRE and JDK it also goes to the JVM and then it is ready to run the java program and also interprets the program. It normally compiles the code and then runs the bytecode that is provided by the compiler. And the output produced by the JVM is easily executable on any machine. So this is the main reason behind Java being platform Independent.
Features of JAVA
- High performance