Introduction to Java
What is Java?
Java is a high-level, object-oriented, platform-independent programming language
developed by Sun Microsystems (now owned by Oracle) in 1995. It is widely used for building
applications ranging from mobile apps (Android) to web applications, desktop software,
games, and enterprise systems.
Key Features of Java
1. Simple
Java is easy to learn compared to other languages like C++. It removes complex features such as
pointers, multiple inheritance, and operator overloading.
2. Object-Oriented Programming (OOP)
Everything in Java is treated as an object. The four main OOP principles are:
Encapsulation
Inheritance
Polymorphism
Abstraction
3. Platform Independent
Java uses the concept of WORA – Write Once, Run Anywhere.
Your Java code is compiled into bytecode, which can run on any device that has a Java Virtual
Machine (JVM).
4. Secure
Java has a strong security model. It runs code inside a sandbox and includes features like
bytecode verification and automatic memory management.
5. Robust
Java handles errors well and avoids crashes using:
Exception handling
Garbage collection (automatic memory cleanup)
6. Multithreaded
Java supports running multiple tasks simultaneously (threads), useful in animation, games,
servers, etc.
7. Distributed
Java supports networking easily through libraries like [Link], making it suitable for
distributed systems.
Java Architecture
1. JDK – Java Development Kit
Used to write, compile, and run Java programs.
2. JRE – Java Runtime Environment
Provides the environment required to run your Java applications.
3. JVM – Java Virtual Machine
Executes the bytecode and makes Java platform independent.
First Java Program Example
class HelloWorld {
public static void main(String[] args) {
[Link]("Hello, Java!");
}
}
How it works:
class → Defines a class
main() → Starting point of every Java program
[Link]() → Prints output on screen
Applications of Java
Java is used in:
Android mobile apps
Web applications (Spring Framework)
Banking & enterprise software
Cloud applications
IoT devices
Game development