0% found this document useful (0 votes)
10 views4 pages

PGDCA Java Unit1 Unit3 Notes

The document provides an overview of Object-Oriented Programming (OOP) principles such as encapsulation, inheritance, polymorphism, and abstraction, along with Java basics including data types and control structures. It also covers exception handling, types of exceptions, and file I/O operations, detailing relevant classes and flowcharts for object creation and file handling. Additionally, it explains serialization and deserialization processes for converting objects to byte streams and vice versa.

Uploaded by

kritikaa2205
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)
10 views4 pages

PGDCA Java Unit1 Unit3 Notes

The document provides an overview of Object-Oriented Programming (OOP) principles such as encapsulation, inheritance, polymorphism, and abstraction, along with Java basics including data types and control structures. It also covers exception handling, types of exceptions, and file I/O operations, detailing relevant classes and flowcharts for object creation and file handling. Additionally, it explains serialization and deserialization processes for converting objects to byte streams and vice versa.

Uploaded by

kritikaa2205
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

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.

You might also like