0% found this document useful (0 votes)
27 views2 pages

Lesson 2 Java Class Notes - Object-Oriented Programming Basics

This document provides an introduction to Object-Oriented Programming (OOP) concepts in Java, aimed at high school or first-year computer science students. It covers key principles such as classes, objects, encapsulation, inheritance, and abstraction, along with examples and a mini exercise. The document also includes a quick review of essential terms related to OOP.

Uploaded by

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

Lesson 2 Java Class Notes - Object-Oriented Programming Basics

This document provides an introduction to Object-Oriented Programming (OOP) concepts in Java, aimed at high school or first-year computer science students. It covers key principles such as classes, objects, encapsulation, inheritance, and abstraction, along with examples and a mini exercise. The document also includes a quick review of essential terms related to OOP.

Uploaded by

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

Java Class Notes – Object-Oriented Programming Basics

Description:
This file contains an easy-to-follow introduction to OOP concepts in Java: classes, objects,
encapsulation, inheritance, and abstraction. It is designed for high school or first-year CS
students.

🧱 What is Object-Oriented Programming (OOP)?

Object-Oriented Programming (OOP) is a method of programming that organizes code using


objects and classes. Java is a fully object-oriented language (except for primitive types).

🧩 Main Principles of OOP

1. Class
A blueprint or template for creating objects.
2. Object
An instance of a class.
3. Encapsulation
Hiding the internal details of objects and exposing only what's necessary.
4. Inheritance
A mechanism where one class can inherit features (fields and methods) from another.
5. Abstraction
Showing only essential features and hiding the unnecessary details.

🏗️Example: Defining a Simple Class


java
CopyEdit
class Student {
int id;
String name;

void display() {
System.out.println("ID: " + id);
System.out.println("Name: " + name);
}
}

🧪 Creating an Object of a Class


java
CopyEdit
public class Main {
public static void main(String[] args) {
Student s1 = new Student();
s1.id = 101;
s1.name = "Alice";
s1.display();
}
}

🧠 Mini Exercise

Create a class Car with:

 Properties: brand, model, year


 Method: start() prints "Car is starting..."

✅ Quick Review

Term Description
Class Blueprint of objects
Object Instance of a class
Method Function inside a class
Constructor Special method to initialize objects

You might also like