SlideShare a Scribd company logo
Basics of Object Oriented
Programming
Dr.A.Martin, ME, Ph.D.
Assistant Professor,
Dept. of Computer Science,
School of Mathematics and Computer Sciences,
Central University of Tamil Nadu,
Thiruvarur, Tamilnadu-610 101.
Agenda
• Structured Programming
• Limitations in Structured Programming
• Object Oriented Programming
• Classes and Objects
• OOP’s Principles
• Static and Non Static Data
• Accessibility
• Exception Handling and Templates
Structured Programming
• It employs a top-down design model - map
out the overall program structure into
separate subsections.
• A defined function or set of similar functions
is coded in a separate module or sub module.
• Most famous for removing or reducing flaws
on the GOTO statement.
• E.g. C – The Programming Language.
Limitations in structured programming
• Data hiding
• Debugging of programs are hard
– Not Possible to handle run time errors and future
enhancements.
• Non Flexibility of Code
– In procedural programming, parts of code are
interdependent.
– This interdependency makes modification &
manipulation of a particular part of the program
without affecting other parts.
Limitations in structured programming
• Software development period is high.
• Software cost is high.
• If end user requirement changes a big
modification is needed in software
• More stress laid on procedures not on data
Object Oriented Programming
• In object oriented programming data and the
instruction for processing that data are
combined into a self-sufficient “object” that
can be used in other programs.
• It is a programming methodology used to
solve and develop complex problems by using
oops principles.
• Real world objects
• Software Objects
• Mapping of Real objects to software objects.
Class and Objects
• A Vehicle – A Car
• Mechanism – Break System, Radiator Cooling
System, Auto Door Lock, Air Conditioning, Safety
System, Security Mechanism, Gear Mechanism,
etc.,
• Spare Parts - Tires, Number of Tires, Head Light,
Density of air in tiers, Switch, window, door,
Number of windows and doors, Number of
seats.
• Car created with mechanism and spare parts.
• So many types – all from same car – differs in
flexibility and luxuries.
• Class – The bundling of data and functions
that acting on data on a single place.
• Class is a mould upon which objects are
created.
• The logical thing class is invoked by the real
thing object.
• The instance of the class is object.
OOPs Principles,
Encapsulation
Inheritance
Polymorphism
Data abstraction
Encapsulation – A rigid wall
• The binding of data and functions together to
achieve information hiding and modularity.
• Not allowed to enter.
• Not same kind of restriction to everyone.
• We want to some level of flexibility.
• Accessibility – access specifiers
• Public , Private and Protected
• Default.
Inheritance
 It allows the creation of hierarchical classifications.
 Using inheritance, you can create a general class that
defines common properties.
 This class may then inherit by more specific classes,
each adding only those things that are unique to the
inheriting class.
 The process of creating new classes from existing
classes.
 A class that inherited is referred to as a base class.
 The class that does the inheriting is called derived
class.
Benefits,
 New classes can be derived by the user
from the existing classes without any
modification.
 It saves time and money.
 It reduces program coding time.
 It increases the reliability of the program.
Types of Inheritance
 Single : one base class and derived class
 Multiple : Many base class to one derived
class
 Multilevel : derived classes in a sequential
order
 Hierarchical : one base class and many
derived class
 Hybrid : A class derived from a base class
and an inheritance class
Polymorphism
• One interface with different forms
• Moving of a vehicle – Energy required.
• Energy available in different forms
• Fuel – Petrol, Diesel, Solar, Electric – Battery.
• Objective – Moving – achieved with different
ways.
• Compile time polymorphism and Run time
polymorphism.
Compile time polymorphism and Run time
polymorphism.
• Function overloading
 Same function with different arguments
Sum(int a ,int b)
Sum (double a, double b)
Sum (double a, double b, double c)
Sum (int a, long b)
 Need not worry about return type.
Function overriding
• Both base class and sub class have the
identical function.
• Same name, same number of arguments,
same data type.
• The function which is available in derived class
overrides the function in base class – called as
function overriding.
Static and Non Static Data
• Single copy shared by all instances
• Individual copy for every object
• How objects created for a class.
• How memory is allocated and reclaimed for
objects.
• Garbage collection.
• Constructor and Destructor. [C++]
• Constructor and Garbage Thread [Java].
Accessibility Levels
• Public, Private and Protected. [C++]
• Public, Private and Protected and default.
[Java]
this pointer
• Avoids name collision
• Refers the current object
Templates
• Templates are mechanism that make it
possible to use one function or class to handle
different data types.
• Function Template
• Class Template

More Related Content

PPTX
O op lecture 04
PPTX
More oop in java
PPT
PHP - Procedural To Object-Oriented
PPTX
Object Oriented Programming Principles
PPTX
[OOP - Lec 06] Classes and Objects
PPTX
Oopsinphp
PPTX
[OOP - Lec 01] Introduction to OOP
PPTX
Object oriented programming
O op lecture 04
More oop in java
PHP - Procedural To Object-Oriented
Object Oriented Programming Principles
[OOP - Lec 06] Classes and Objects
Oopsinphp
[OOP - Lec 01] Introduction to OOP
Object oriented programming

Similar to Basics of object oriented programming interview tips for Java (20)

PPTX
SKILLWISE - OOPS CONCEPT
PDF
Cs2305 programming paradigms lecturer notes
PDF
1unit-120324103142-phpapp02.pdf
PPT
8 oo approach&uml-23_feb
PPTX
PPTX
Principles and advantages of oop ppt
PPTX
Introduction to OOP concepts
PDF
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
PDF
Data structures and algorithms Module-1.pdf
PPTX
1 unit (oops)
PPTX
Unit - I Intro. to OOP Concepts and Control Structure -OOP and CG (2024 Patte...
PPTX
UNIT - 1 Java Fundamentals, Basics of java
PPT
Basic concepts of oops
PPTX
Need of object oriented programming
PPTX
Unit 2.pptx
PPTX
Unit 2.pptx
PDF
Deep Learning For Practitioners, lecture 2: Selecting the right applications...
PPTX
OOPsConceptspythonenineeringcomputerscienceand engineering.pptx
PPTX
Intro to Data Structure & Algorithms
PPTX
Object Oriented Programming (OOP) Introduction
SKILLWISE - OOPS CONCEPT
Cs2305 programming paradigms lecturer notes
1unit-120324103142-phpapp02.pdf
8 oo approach&uml-23_feb
Principles and advantages of oop ppt
Introduction to OOP concepts
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
Data structures and algorithms Module-1.pdf
1 unit (oops)
Unit - I Intro. to OOP Concepts and Control Structure -OOP and CG (2024 Patte...
UNIT - 1 Java Fundamentals, Basics of java
Basic concepts of oops
Need of object oriented programming
Unit 2.pptx
Unit 2.pptx
Deep Learning For Practitioners, lecture 2: Selecting the right applications...
OOPsConceptspythonenineeringcomputerscienceand engineering.pptx
Intro to Data Structure & Algorithms
Object Oriented Programming (OOP) Introduction
Ad

Recently uploaded (20)

PDF
AI in Product Development-omnex systems
PPTX
CRUISE TICKETING SYSTEM | CRUISE RESERVATION SOFTWARE
PPTX
Save Business Costs with CRM Software for Insurance Agents
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
The Role of Automation and AI in EHS Management for Data Centers.pdf
PDF
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
PPTX
Online Work Permit System for Fast Permit Processing
PDF
Digital Strategies for Manufacturing Companies
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PPT
JAVA ppt tutorial basics to learn java programming
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Become an Agentblazer Champion Challenge
PPTX
What to Capture When It Breaks: 16 Artifacts That Reveal Root Causes
PDF
Build Multi-agent using Agent Development Kit
PDF
Forouzan Book Information Security Chaper - 1
PDF
Multi-factor Authentication (MFA) requirement for Microsoft 365 Admin Center_...
PDF
top salesforce developer skills in 2025.pdf
PPTX
ai tools demonstartion for schools and inter college
PDF
A REACT POMODORO TIMER WEB APPLICATION.pdf
AI in Product Development-omnex systems
CRUISE TICKETING SYSTEM | CRUISE RESERVATION SOFTWARE
Save Business Costs with CRM Software for Insurance Agents
Which alternative to Crystal Reports is best for small or large businesses.pdf
The Role of Automation and AI in EHS Management for Data Centers.pdf
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
Online Work Permit System for Fast Permit Processing
Digital Strategies for Manufacturing Companies
ManageIQ - Sprint 268 Review - Slide Deck
JAVA ppt tutorial basics to learn java programming
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
How to Migrate SBCGlobal Email to Yahoo Easily
Become an Agentblazer Champion Challenge
What to Capture When It Breaks: 16 Artifacts That Reveal Root Causes
Build Multi-agent using Agent Development Kit
Forouzan Book Information Security Chaper - 1
Multi-factor Authentication (MFA) requirement for Microsoft 365 Admin Center_...
top salesforce developer skills in 2025.pdf
ai tools demonstartion for schools and inter college
A REACT POMODORO TIMER WEB APPLICATION.pdf
Ad

Basics of object oriented programming interview tips for Java

  • 1. Basics of Object Oriented Programming Dr.A.Martin, ME, Ph.D. Assistant Professor, Dept. of Computer Science, School of Mathematics and Computer Sciences, Central University of Tamil Nadu, Thiruvarur, Tamilnadu-610 101.
  • 2. Agenda • Structured Programming • Limitations in Structured Programming • Object Oriented Programming • Classes and Objects • OOP’s Principles • Static and Non Static Data • Accessibility • Exception Handling and Templates
  • 3. Structured Programming • It employs a top-down design model - map out the overall program structure into separate subsections. • A defined function or set of similar functions is coded in a separate module or sub module. • Most famous for removing or reducing flaws on the GOTO statement. • E.g. C – The Programming Language.
  • 4. Limitations in structured programming • Data hiding • Debugging of programs are hard – Not Possible to handle run time errors and future enhancements. • Non Flexibility of Code – In procedural programming, parts of code are interdependent. – This interdependency makes modification & manipulation of a particular part of the program without affecting other parts.
  • 5. Limitations in structured programming • Software development period is high. • Software cost is high. • If end user requirement changes a big modification is needed in software • More stress laid on procedures not on data
  • 6. Object Oriented Programming • In object oriented programming data and the instruction for processing that data are combined into a self-sufficient “object” that can be used in other programs. • It is a programming methodology used to solve and develop complex problems by using oops principles. • Real world objects • Software Objects • Mapping of Real objects to software objects.
  • 7. Class and Objects • A Vehicle – A Car • Mechanism – Break System, Radiator Cooling System, Auto Door Lock, Air Conditioning, Safety System, Security Mechanism, Gear Mechanism, etc., • Spare Parts - Tires, Number of Tires, Head Light, Density of air in tiers, Switch, window, door, Number of windows and doors, Number of seats. • Car created with mechanism and spare parts. • So many types – all from same car – differs in flexibility and luxuries.
  • 8. • Class – The bundling of data and functions that acting on data on a single place. • Class is a mould upon which objects are created. • The logical thing class is invoked by the real thing object. • The instance of the class is object.
  • 10. Encapsulation – A rigid wall • The binding of data and functions together to achieve information hiding and modularity. • Not allowed to enter. • Not same kind of restriction to everyone. • We want to some level of flexibility. • Accessibility – access specifiers • Public , Private and Protected • Default.
  • 11. Inheritance  It allows the creation of hierarchical classifications.  Using inheritance, you can create a general class that defines common properties.  This class may then inherit by more specific classes, each adding only those things that are unique to the inheriting class.  The process of creating new classes from existing classes.  A class that inherited is referred to as a base class.  The class that does the inheriting is called derived class.
  • 12. Benefits,  New classes can be derived by the user from the existing classes without any modification.  It saves time and money.  It reduces program coding time.  It increases the reliability of the program.
  • 13. Types of Inheritance  Single : one base class and derived class  Multiple : Many base class to one derived class  Multilevel : derived classes in a sequential order  Hierarchical : one base class and many derived class  Hybrid : A class derived from a base class and an inheritance class
  • 14. Polymorphism • One interface with different forms • Moving of a vehicle – Energy required. • Energy available in different forms • Fuel – Petrol, Diesel, Solar, Electric – Battery. • Objective – Moving – achieved with different ways. • Compile time polymorphism and Run time polymorphism.
  • 15. Compile time polymorphism and Run time polymorphism. • Function overloading  Same function with different arguments Sum(int a ,int b) Sum (double a, double b) Sum (double a, double b, double c) Sum (int a, long b)  Need not worry about return type.
  • 16. Function overriding • Both base class and sub class have the identical function. • Same name, same number of arguments, same data type. • The function which is available in derived class overrides the function in base class – called as function overriding.
  • 17. Static and Non Static Data • Single copy shared by all instances • Individual copy for every object • How objects created for a class. • How memory is allocated and reclaimed for objects. • Garbage collection. • Constructor and Destructor. [C++] • Constructor and Garbage Thread [Java].
  • 18. Accessibility Levels • Public, Private and Protected. [C++] • Public, Private and Protected and default. [Java]
  • 19. this pointer • Avoids name collision • Refers the current object
  • 20. Templates • Templates are mechanism that make it possible to use one function or class to handle different data types. • Function Template • Class Template