UNIT 1: Object Oriented Programming with Java
1. Introduction to OOP
Object-Oriented Programming (OOP) is a programming paradigm based on the concept of objects
which contain data and methods.
OOP Principles
1 Encapsulation: Wrapping data and methods together.
2 Inheritance: One class can inherit properties from another.
3 Polymorphism: One function behaves in different ways.
4 Abstraction: Hiding internal implementation details.
Diagram: OOP Concept
Class → Object → Methods → Data
2. Java Basics
1 Java is platform independent.
2 Java follows Write Once Run Anywhere (WORA).
3 Uses JVM (Java Virtual Machine).
Data Types
1 Primitive: int, float, char, boolean
2 Non-Primitive: Arrays, Classes, Strings
Control Structures
1 if, if-else, switch
2 loops: for, while, do-while
Classes and Objects
Class is a blueprint, Object is an instance of class.
Flowchart: Object Creation
Start → Define Class → Create Object → Call Methods → End
UNIT 3: Exception Handling & File I/O
1. Exception Handling
Exception is an unwanted event that disrupts program execution.
Types of Exceptions
1 Checked Exceptions (Compile-time)
2 Unchecked Exceptions (Runtime)
Try-Catch Flow
Try → Exception Occurs? → Yes → Catch → Handle → End
Keywords
1 try: block to test code
2 catch: handle exception
3 finally: always executes
4 throw: explicitly throw exception
5 throws: declare exception
2. File I/O
File handling is used to read and write data to files.
File Handling Classes
1 FileReader
2 FileWriter
3 BufferedReader
4 BufferedWriter
Flowchart: File Handling
Start → Open File → Read/Write → Close File → End
Serialization
Serialization converts object into byte stream. Deserialization converts it back.