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

Lecture-1. Introduction To OOP

This document provides an introduction to object-oriented programming (OOP). It discusses that OOP involves creating objects that contain both data and methods. It notes advantages like being faster, providing clearer structure, and helping to avoid duplicated code. The main aspects are classes, which define types of objects, and objects, which are instances of classes. A class is a template, while an object is a physical instance that allocates memory. Classes can generate multiple objects.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Lecture-1. Introduction To OOP

This document provides an introduction to object-oriented programming (OOP). It discusses that OOP involves creating objects that contain both data and methods. It notes advantages like being faster, providing clearer structure, and helping to avoid duplicated code. The main aspects are classes, which define types of objects, and objects, which are instances of classes. A class is a template, while an object is a physical instance that allocates memory. Classes can generate multiple objects.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Object Oriented Programming

INTRODUCTION TO OOP
Introduction to OOP

• Creating objects

• Contain both data and methods


Advantages:
• Faster and easier to execute

• Provides a clear structure for the programs

• Helps to keep the Java code DRY "Don't Repeat Yourself", and
makes the code easier to maintain, modify and debug

• Makes it possible to create full reusable applications with less


code and shorter development time
Two Main Aspects

Class Objects
Class
• A way of organizing information about a type of data
so a programmer can reuse elements when making
multiple instances of that data type
• A user-defined type that describes what a certain
type of object will look like
Object

• A collection of related data and/or functionality


• The object is an instance of a class
Class Vs Object
Class Object
A class is a template for creating objects in
The object is an instance of a class.
program.
A class is a logical entity Object is a physical entity
A class does not allocate memory space when it is Object allocates memory space whenever they
created. are created.
You can create more than one object using a
You can declare class only once.
class.
Example: Car. Example: Jaguar, BMW, Tesla, etc.
Class generates objects Objects provide life to the class.
Simple Code Declaring a class

Creating an object

You might also like