Java is an object oriented, general purpose, class based programming that is created by Sun Microsystems in the year 1995. This programming language is designed as it is having lesser implementation dependencies. Java is mainly a computing platform for developing applications. It is a kind of WORA(Write once, run anywhere) programming language. Java is just like C and C++.
With Java various technologies like node js, Spring, Hadoop, Android, J2EE get combined in order to build scalable, robust, distributed and portable applications.
History of Java
James Gosling developed Java at Sun Microsystems during the early 1990s. This project was earlier called “Oak”. Its implementation is similar to C and C++. Java was set earlier for the set top boxes. Its history basically begins with the Green Team.
James Gosling and his team later called this project “Green talk” and named its extension as .gt. Then the name changed to OAK. Java name derives from espresso bean(Java) as Gosling worked in an area where there was a coffee shop. The Java language has undergone various changes. It has developed from a couple of 100 classes in JDK 1.0 to more than 3000 in J2SE 5. Being fast, reliable and secure is used for developing applications in data centers, laptops, cell phones and game consoles. Oracle Corporation, Later, in 2009, grabbed Sun Microsystems and took ownership of three key Sun software assets: Java, MySQL, and Solaris.
Java Platform
The integration of various programs that assist the programmers in developing and running java programming applications in an effective way. There is an execution engine, set of libraries and compiler in Java
What is Java used for?
Here are some important Java applications:
- It is used for developing Android Apps
- Java assists in creating the Enterprise Software
- Many mobile applications are built in Java.
- In big data analytics, Java is used.
- Java is mainly used for Server-Side Technologies like GlassFish, Apache and JBoss etc.
- Many Scientific Computing Applications are built using JAVA.
- It is deployed for hardware devices.
Features of Java
Here are some important Java features:
- JAVA is easy-to-use programming languages to learn.
- It is platform independent.
- Java has complete standalone features.
- Java uses WORA (Write once Run anywhere) kind of principle, it executes on any computing platform.
- Mainly object oriented applications are designed here.
- It has automatic memory management. Supports automatic memory allocation as well as deallocation i.e Garbage collection.
- Java provides multithreading and concurrency.
Java Programming Language- Components
Java programmers write the code in human readable language that is in source code. CPU chips don’t know the source code written in any coding language. Computers only know machine language. These execute code at CPU level.
Example
//Java Program to demonstate the use of if statement.
public class IfExample {
public static void main(String[] args) {
//defining an 'age' variable
int age=20;
//checking the age
if(age>18){
System.out.print("Age is greater than 18");
}
}
}
Java Development kit (JDK)
JAVA applications are deployed for using JDK. Java developers can use it on macOS, Windows,Solaris, and Linux. JDK helps them to do coding and running Java programs. For writing java programs, JDK tools are needed and JRE is needed to run them. It includes a java application launcher, compiler, appletviewer.
Java Virtual Machine (JVM)
The engine that gives a runtime environment for driving java code as well as applications is JVM. The compiler generates the machine code for some specific system in another programming language. But the java compiler produces code for the JAVA virtual machine.
- JVM gives a platform-independent method of running Java source code.
- It has a wide libraries, tools, and frameworks.
- Just-in-Time compiler is there in JVM that converts Java source code into low-level machine language. Hence, it runs faster than a regular application.
Java Runtime Environment (JRE)
Java Runtime environment is that software which is created to execute other softwares. It has class libraries, JVM and class loader. JRE makes usage of relevant package classes like swing, lang, util, awt, maths and runtime libraries. In order to execute Java applets, JRE should be installed in your PC.
Advantages of Java
Java programming is the mostly used programming language.
Simplicity
Java is simpler to utilize, compose, compile, debug, and learn than other programming languages . The vast majority of the individuals don’t realize that Java is simpler than C++. This is so in light of the fact that Java sends programmed memory portions just as the garbage allocation.
Platform-Independent
The excellent thing about Java is, it is utilizing the Java Code which can be executed on any machine. For this, you needn’t bother with some particular programming. You need just a single primary concern that the JVM ought to be there on the machine.
Object-Oriented Approach
It gives the assent of framing standard projects and reusable code. In the OOP approach, the accentuation is on “objects”. Methods and variables are deployed in Java for showing behavior and state.
Allows Distributed computing
The awesome advantage of Java is that it permits distributed processing. In distributed processing, different PCs in an organization are working in synchronization. It conveys applications on various organizations that can aid the usefulness of both information and application.
Secure
Java is secure due to following reasons:-
- Explicit pointers are not supported in Java.
- Java programs execute inside a virtual machine called sandbox.
- Byte-code verifiers allow checking of the code fragments for illegal code that can violate access right to object.
- It provides a java.security package that implements explicit security.
- It provides library level safety.
- After loading new code, run-time security is checked.
Memory allocation
The process in which the computer programs and services are executed to virtual memory spaces. Here the memory is divided into stack and heap
- The Heap section includes Objects (may also contain reference variables).
- The Static section includes Static data/methods.
Multi threading
In Java, multi threading is used to execute two or more threads at a time. The main purpose is to run two or more threads simultaneously in order to maximize CPU utilization. Each and every thread executes parallel to each other. Here in multi threads there is no separate memory allocation, this allows in saving the memory. This allows minimum idle time.