0% found this document useful (0 votes)
3 views

OOPs With Java Notes

The document provides an overview of Object-Oriented Programming (OOP) concepts in Java, including classes, objects, encapsulation, abstraction, inheritance, and polymorphism. It includes examples of a Student class demonstrating object creation and a simple Employee class showcasing encapsulation through private variables and public methods. These foundational concepts are essential for understanding and implementing OOP in Java.

Uploaded by

ss9195672
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

OOPs With Java Notes

The document provides an overview of Object-Oriented Programming (OOP) concepts in Java, including classes, objects, encapsulation, abstraction, inheritance, and polymorphism. It includes examples of a Student class demonstrating object creation and a simple Employee class showcasing encapsulation through private variables and public methods. These foundational concepts are essential for understanding and implementing OOP in Java.

Uploaded by

ss9195672
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Object-Oriented Programming (OOP) with Java - Notes

1. Basic Concepts of OOP

| Concept | Description |

|----------------|---------------------------------------------------------------|

| Class | Blueprint for objects. It defines properties and behaviors. |

| Object | Instance of a class. Represents a real-world entity. |

| Encapsulation | Wrapping data and methods into a single unit (class). |

| Abstraction | Hiding internal details, showing only essential features. |

| Inheritance | One class inherits properties and behaviors from another. |

| Polymorphism | Ability to take many forms - method overloading/overriding. |

2. Class and Object Example

class Student {

String name;

int age;

void display() {

System.out.println(name + " is " + age + " years old.");

public class Main {

public static void main(String[] args) {

Student s1 = new Student();


s1.name = "John";

s1.age = 20;

s1.display();

3. Encapsulation

Using private variables and public getters/setters.

class Employee {

private int salary;

public void setSalary(int s) {

salary = s;

public int getSalary() {

return salary;

You might also like