In 1991, Sun Microsystems Inc. developed JAVA, which Oracle Corporation eventually purchased. James Gosling and Patrick Naughton created it. The programming language is straightforward. In Java, writing, compiling, and debugging programs is simple. It supports the development of modular software and reusable code.
Let’s become familiar with some basic Java phrases before we begin learning the language.
Java Virtual Machine (JVM)
- JVM is the common name for this. Before we talk about the JVM, let’s look at the stages of program execution. The process is broken down into three steps: writing the program, compiling it, and running it.
1) Java programmers like you and me are responsible for writing the software.
2) The main Java compiler used in the Java Development Kit is called javac, and it compiles programs (JDK). It produces java bytecode after receiving a java application as input.
3) In the third phase, the JVM runs the bytecode produced by the compiler. Program run phase refers to this.
Now that we are aware that the JVM’s main purpose is to run the bytecode generated by the compiler. Although each operating system uses a distinct JVM, they all give the same results when bytecode is executed. Java is referred to as a platform agnostic language for this reason.
As was already said, the JDK’s javac compiler converts Java source code into bytecode so that JVM may run it. The compiler stores the bytecode in a.class file.
Java Development Kit(JDK)
I’ve used the word JDK while discussing JVM and bytecode. Let’s talk about it now. JRE (Java Runtime Environment), compilers, and a number of tools, like JavaDoc, a Java debugger, etc. are all included in this comprehensive Java development kit, as the name would imply.
JDK must be installed on your computer in order for Java programs to be created, compiled, and launched.
Java Runtime Environment(JRE)
Since JRE is a component of JDK, JDK also contains JRE. When JRE is installed on your computer, Java programs can be executed, but they cannot be compiled. JRE features support for applets, browser plugins, and JVM. JRE is all that is required when you merely need to run a Java program on your machine.
Main Features of JAVA
Java is a platform independent language
Java source code (.java files) are converted to bytes by the compiler (javac) (.class file). As previously indicated, JVM runs the bytecode generated by the compiler. Any platform, such as Windows, Linux, Mac OS, etc., may run this byte code. This implies that an application created for Windows may operate on Linux and vice versa. Although each operating system uses a distinct JVM, they all give the same results when bytecode is executed. Java is referred to as a platform agnostic language for this reason.
Java is an Object Oriented language
The method of structuring programs as a collection of objects, each of which represents an instance of a class, is known as object-oriented programming.
There are 4 key ideas in object-oriented programming:
Because it lacks sophisticated features like operator overloading, multiple inheritance, pointers, and explicit memory allocation, Java is regarded as one of the simpler languages.
Reliable means robust. Because early error detection is highly valued in the development of the Java programming language, the Java compiler is able to identify mistakes that are difficult to see in other programming languages. Garbage collection, exception handling, and memory allocation are three of Java’s primary strengths.
In Java, there are no pointers and accessing an out-of-bounds array results in an ArrayIndexOutOfBoundsException. Because of this, Java cannot be used to exploit certain security weaknesses like stack corruption or buffer overflow.
Java is distributed
Java is a computer language that allows us to build distributed applications. Java distributed applications are made using RMI (Remote Method Invocation) and EJB (Enterprise Java Beans). Simply put: Java applications may be distributed over several systems that are linked to one another via the internet. Procedures on a distant JVM can be executed by objects on a local JVM.
Java has multithreading capability. Java’s multithreading functionality enables the concurrent execution of two or more application components for optimal CPU utilization.
Java code created on one system may, as was already said, execute on another. Java code is portable because it can run on any platform thanks to platform agnostic byte code.