Introduction to Java
• A high-level, class-based, object-oriented
programming language.
• Developed by Sun Microsystems, now owned
by Oracle.
Why Java?
• - Platform Independent
• - Object-Oriented
• - Secure and Robust
• - Large Community Support
Java Features
• - Simple
• - Portable
• - Platform-independent
• - Secured
• - Robust
• - Multithreaded
Java Editions
• - Java SE (Standard Edition)
• - Java EE (Enterprise Edition)
• - Java ME (Micro Edition)
• - JavaFX
Java Architecture
• - Source Code (.java)
• - Compiler
• - Bytecode (.class)
• - Java Virtual Machine (JVM)
JVM, JRE, and JDK
• - JVM: Runs Java bytecode
• - JRE: JVM + Libraries
• - JDK: JRE + Development tools
Hello World Program
• public class HelloWorld {
• public static void main(String[] args) {
• System.out.println("Hello, World!");
• }
• }
Data Types
• - Primitive: int, char, float, boolean
• - Non-Primitive: String, Arrays, Classes
Variables and Keywords
• - Variable: container for storing data
• - Keywords: reserved words like int, class,
static, etc.
Operators
• - Arithmetic: +, -, *, /
• - Relational: ==, !=, >, <
• - Logical: &&, ||, !
Control Statements
• - if, else if, else
• - switch
• - for, while, do-while loops
OOP Concepts
• - Class and Object
• - Inheritance
• - Polymorphism
• - Abstraction
• - Encapsulation
Classes and Objects
• - Class: blueprint
• - Object: instance of a class
• - Syntax: class MyClass { ... }
Constructors
• - Special method to initialize objects
• - No return type
• - Can be parameterized
Inheritance
• - Mechanism to acquire properties
• - Keyword: extends
• - Single, Multilevel, Hierarchical
Polymorphism
• - Compile-time (Method Overloading)
• - Runtime (Method Overriding)
Abstraction and Interface
• - Abstraction: hiding implementation details
• - Interface: multiple inheritance in Java
Exception Handling
• - try, catch, finally, throw, throws
• - Handles runtime errors
Collections Framework
• - List, Set, Map, Queue
• - Utility classes for managing groups of objects
Conclusion
• Java is a powerful and versatile programming
language.
• Used in web, mobile, desktop, and enterprise
applications.