Object means a usable entity such as a phone, book, table, computer, watch, etc.
Object-Oriented Programming is a method or model of designing programs using classes and objects. It helps simplify software development and maintenance by providing several core concepts.
In this lesson, we will study the fundamental concepts of Java (OOPs) — Object-Oriented Programming Systems.
Java OOPs (Object-Oriented Programming) Concepts
- Class
- Object
- Inheritance
- Polymorphism
- Abstraction
- Encapsulation
Class
In object-oriented programming, a class is a blueprint from which individual objects are created (or we can say that a class is a data type of an object type). In Java, everything is related to classes and objects. Each class has its own methods and attributes, which can be accessed and managed through objects.
If you want to create a class for students, then “Student” will be a class, and the student records (such as student1, student2, etc.) will be objects.
We can also consider a class as a factory (a user-defined blueprint) used to produce objects.
Source Code:
public class Student {
// Fields (attributes)
String name;
int age;
String studentId;
// Constructor
public Student(String name, int age, String studentId) {
this.name = name;
this.age = age;
this.studentId = studentId;
}
// Method to display student information
public void displayInfo() {
System.out.println("Student ID: " + studentId);
System.out.println("Name: " + name);
System.out.println("Age: " + age);
System.out.println("-------------------------");
}
// Main method to create and display student objects
public static void main(String[] args) {
// Creating student objects
Student student1 = new Student("Alice", 20, "S101");
Student student2 = new Student("Bob", 22, "S102");
// Displaying information
student1.displayInfo();
student2.displayInfo();
}
}Result:
Watch the video:Ebook: https://softkhpc.blogspot.com/2025/05/java-programming-ebooks.html

