Java Introduction:
Java is a Programming Language.
Java is a high-level, object-oriented programming language that enables
developers to write instructions for execution.
For example, "teacher" who gives the instructions to students to perform specific
tasks, developers use Java to instruct the system to execute desired operations like
addition, subtraction, division, login, register, add items into cart, online payment etc.
Java is a platform that provides a robust environment, or "stage," where developers
can execute Java code. This platform ensures all necessary tools and libraries are
available for the code to run smoothly.
Java was originally developed by James Gosling and his team of engineers at Sun
Microsystems. Its development was started in June 1991, and first public version
was released in 1996.
In 2010, Oracle Corporation acquired Sun Microsystems, which made Oracle the
owner of Java and its associated technologies. Since then, Oracle has been
responsible for maintaining and advancing the Java platform.
Features of Java:
Java is a popular programming language known for its simplicity, platform
independence, and robustness which makes it versatile for a wide range of
applications. Some most important core features in java are as below: -
Platform-Independent
Definition: Java applications are designed to run on any platform that has a Java
Virtual Machine (JVM) without requiring modification.
Object-Oriented
Definition: Java is built around the principles of object-oriented programming (OOP),
which organizes software design around data and Objects.
Robust
Definition: Java is designed to be a reliable and error-resistant programming
language.
Secure
Definition: Java incorporates various security features to protect applications from
unauthorized access and malicious activities.
Portable
Definition: Java's portability allows compiled programs to run on any platform with a
JVM, ensuring cross-platform compatibility.
Simple
Definition: Java is designed to be a straightforward and accessible programming
language.
Multithreaded
Definition: Java provides built-in support for concurrent execution, allowing multiple
threads to run simultaneously.
Distributed
Definition: Java facilitates the development of distributed applications, where
components can communicate over a network.
Dynamic
Definition: Java is an adaptable and flexible language, capable of accommodating
changes and extending its functionalities.
High Performance
Definition: Java is designed to deliver high performance while maintaining portability
and security.
Use of java:
Web Development
Enterprise Applications
Mobile Applications
Desktop Applications
Scientific and Research Applications
Big Data Technologies
Embedded Systems
Cloud Computing
JDK, JRE & JVM:
The Java Development Kit (JDK) is a software development kit used to
develop applications in the Java programming language.
JDK (Java Development Kit) = Development Tools + JRE (Java Runtime
Environment)
Java Runtime Environment (JRE):
Function: Provides the libraries, Java Virtual Machine (JVM), and other components
to run Java applications.
Included: The JRE is part of the JDK, and it includes the JVM along with the
necessary runtime libraries.
JRE (Java Runtime Environment) = Java Libraries + Unser Interface Toolkits +
Deployment + JVM (Java Virtual Machine)
The JVM is a part of the Java platform that executes Java bytecode, converting it
into machine code for the host system. It provides an abstraction layer between
compiled Java code and the operating system.
Usage of JDK: -
Development: Used by developers to create and compile Java applications.
Installation: Requires installation on the developer’s machine and is not required for
end-users who only need to run Java applications.
Usage of JRE: -
Java Runtime Environment (JRE) is used to provide a runtime platform for executing
Java applications. It includes the JVM, core libraries, and resources required to run
Java programs, ensuring platform independence and handling tasks like memory
management, security, and execution of compiled Java code.
Usage of JVM: -
The JVM interprets or compiles the bytecode into native machine code that can be
executed by the host machine. This enables Java programs to run on any device or
operating system that has a compatible JVM implementation, adhering to the
principle of "Write Once, Run Anywhere."
Simple Java Hello Program:
public class HelloWorld
{
public static void main(String[] args)
{
[Link]("Hello JAVA");
}
}
How Java Works Step by Step
Step 1: Writing the Java Program
Step 2: Compilation
Step 3: Bytecode (.class file)
Step 4: Execution
Step 5: Output