Java Overview
What is Java?
Java is a high-level, object-oriented programming language developed by Sun Microsystems
(now owned by Oracle) in 1995. It's designed to be platform-independent, following the
principle "Write Once, Run Anywhere" (WORA).
Key Characteristics
1. Platform Independent
• Compiled to bytecode that runs on the Java Virtual Machine (JVM)
• Same code works on Windows, Mac, Linux, etc.
2. Object-Oriented
• Everything revolves around objects and classes
• Supports inheritance, polymorphism, encapsulation, abstraction
3. Simple & Familiar
• Syntax similar to C/C++
• Removed complex features (pointers, operator overloading)
• Automatic memory management (garbage collection)
4. Robust & Secure
• Strong type checking
• Exception handling
• Security features built-in
Core Components
┌─────────────────────────────────────┐
│ Java Source Code (.java) │
└──────────────┬──────────────────────┘
▼
┌─────────────────────────────────────┐
│ Java Compiler (javac) │
└──────────────┬──────────────────────┘
┌─────────────────────────────────────┐
│ Bytecode (.class) │
└──────────────┬──────────────────────┘
┌─────────────────────────────────────┐
│ JVM (Java Virtual Machine) │
└─────────────────────────────────────┘
Main Features
• Multithreading: Built-in support for concurrent programming
• Distributed: Supports networking and distributed computing
• Dynamic: Can adapt to evolving environments
• High Performance: JIT (Just-In-Time) compilation
• Rich API: Extensive standard library
Common Use Cases
1. Enterprise Applications (Spring, Java EE)
2. Android Mobile Apps
3. Web Applications (JSP, Servlets, Spring Boot)
4. Big Data Technologies (Hadoop, Apache Spark)
5. Desktop Applications (JavaFX, Swing)
6. Scientific Applications
7. Cloud-based Applications
Java Ecosystem
Component Purpose
JDK Java Development Kit (compiler, tools)
JRE Java Runtime Environment (runs Java apps)
JVM Java Virtual Machine (executes bytecode)
Popular Frameworks & Tools
• Spring/Spring Boot: Enterprise applications
• Hibernate: Object-relational mapping (ORM)
• Maven/Gradle: Build tools
• JUnit: Testing framework
• Apache Tomcat: Web server
Basic Syntax Example
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
Advantages
• Platform independence
• Large community and ecosystem
• Extensive documentation
• Strong enterprise support
• Mature and stable
• Excellent tools and IDEs
Disadvantages
• Verbose syntax
• Slower than native languages (C/C++)
• Memory consumption
• GUI development less popular now
• Paid licensing for some Oracle JDK versions
Java Versions
• Java 8 (2014): Lambda expressions, Stream API
• Java 11 (2018): LTS version
• Java 17 (2021): Current LTS version
• Java 21 (2023): Latest LTS version
Getting Started
1. Install JDK
2. Set up IDE (IntelliJ IDEA, Eclipse, VS Code)
3. Write your first program
4. Compile: javac FileName.java
5. Run: java FileName