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

Java OOP FileHandling Exceptions Reviewer

The document provides an introduction to Object-Oriented Programming (OOP), outlining its organization through objects that contain data and behavior. It highlights the advantages of OOP, such as code reusability and easy maintenance, and explains key concepts including classes, encapsulation, abstraction, inheritance, and polymorphism. Additionally, it covers Java file handling and exception management, offering insights into reading, writing, appending, and deleting files, as well as handling runtime errors.

Uploaded by

faithashe652
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)
11 views2 pages

Java OOP FileHandling Exceptions Reviewer

The document provides an introduction to Object-Oriented Programming (OOP), outlining its organization through objects that contain data and behavior. It highlights the advantages of OOP, such as code reusability and easy maintenance, and explains key concepts including classes, encapsulation, abstraction, inheritance, and polymorphism. Additionally, it covers Java file handling and exception management, offering insights into reading, writing, appending, and deleting files, as well as handling runtime errors.

Uploaded by

faithashe652
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

INTRODUCTION TO OOP

Object-Oriented Programming (OOP) organizes programs using objects. Objects contain data
(attributes) and behavior (methods).

WHY USE OOP


• Organized code
• Easy maintenance
• Reusability
• Real-world modeling

ADVANTAGES OF OOP
• Code Reusability
• Modularity
• Easy Maintenance
• Data Security
• Real-world Representation

CLASS AND OBJECT


Class – blueprint of an object
Object – instance of a class

FOUR PILLARS OF OOP


Encapsulation, Abstraction, Inheritance, Polymorphism

ENCAPSULATION
Hides data using private variables and public getter and setter methods.

ABSTRACTION
Shows only important details using abstract classes and interfaces.

INHERITANCE
Allows a class to inherit properties and methods from another class.
POLYMORPHISM
Same method name but different behavior.

JAVA FILE HANDLING


Used to create, read, write, append, and delete files.

READING FILES
Scanner, FileReader, BufferedReader

WRITING FILES
FileWriter, BufferedWriter, PrintWriter

APPENDING AND DELETING FILES


Append using FileWriter(true). Delete using delete() method.

JAVA EXCEPTIONS
Exceptions are runtime errors that interrupt normal program execution.

TYPES OF EXCEPTIONS
Checked Exceptions and Unchecked (Runtime) Exceptions

EXCEPTION HANDLING KEYWORDS


try, catch, finally, throw, throws

END
Good luck on your Java exam!

You might also like