Introduction to OOP in Java
• Java is an object-oriented programming
language.
• OOP is a programming paradigm based on
objects and classes.
• Encourages modularity, reusability, and
maintainability.
• Main aim: Represent real-world entities as
software objects.
Key Concepts of OOP
• Class – Blueprint for objects.
• Object – Instance of a class.
• Encapsulation – Wrapping data and methods
together; use of getters and setters.
• Inheritance – Acquiring properties and methods of
another class.
• Polymorphism – Ability to take multiple forms
(method overloading & overriding).
• Abstraction – Hiding internal implementation and
showing only functionality.
Features of OOP in Java
• Modularity – Programs are divided into
objects.
• Reusability – Use existing classes for new
functionality.
• Flexibility & Scalability – Easier to modify and
extend.
• Security – Data can be hidden through
encapsulation.
Example in Java
Class class Car
{
String color; void display()
{
[Link]("Car color: " + color);
}
}
Main class public class Main
{
public static void main(String[] args)
{
Car myCar = new Car();
Object [Link] = "Red";
[Link]();
}
}
• OOP in Java models real-world entities
efficiently.
• Key benefits: reusability, modularity, and
easier maintenance.
• Essential for building robust, scalable, and
secure applications.
History of Java
• 1991: Java was initiated by James Gosling and his team at Sun Microsystems
(originally called Oak).
• 1995: Officially released as Java 1.0, focused on cross-platform development.
• 1996-1999: Java 1.1 and 1.2 released; introduction of Swing, Collections, and
JIT Compiler.
• 2004: Java 5 (1.5) introduced Generics, Metadata, and Enhanced for Loop.
• 2006: Sun released Java as Open Source (OpenJDK).
• 2011-Present: Oracle maintains Java; new versions released every 6 months
with improvements in performance, security, and language features.
Key Points:
• Developed for “Write Once, Run Anywhere (WORA)”.
• Widely used in desktop, web, mobile, and enterprise applications.