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
iTop VPN Crack Latest Version Full Key 2025
PPTX
"Secure File Sharing Solutions on AWS".pptx
PDF
Types of Token_ From Utility to Security.pdf
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
PPTX
CNN LeNet5 Architecture: Neural Networks
PDF
AI Guide for Business Growth - Arna Softech
PPTX
assetexplorer- product-overview - presentation
PDF
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
PDF
MCP Security Tutorial - Beginner to Advanced
PDF
Time Tracking Features That Teams and Organizations Actually Need
PDF
Wondershare Recoverit Full Crack New Version (Latest 2025)
PDF
Salesforce Agentforce AI Implementation.pdf
PPTX
Computer Software - Technology and Livelihood Education
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
Microsoft Office 365 Crack Download Free
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PPTX
Oracle Fusion HCM Cloud Demo for Beginners
PDF
Website Design Services for Small Businesses.pdf
iTop VPN Crack Latest Version Full Key 2025
"Secure File Sharing Solutions on AWS".pptx
Types of Token_ From Utility to Security.pdf
Monitoring Stack: Grafana, Loki & Promtail
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
CNN LeNet5 Architecture: Neural Networks
AI Guide for Business Growth - Arna Softech
assetexplorer- product-overview - presentation
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
MCP Security Tutorial - Beginner to Advanced
Time Tracking Features That Teams and Organizations Actually Need
Wondershare Recoverit Full Crack New Version (Latest 2025)
Salesforce Agentforce AI Implementation.pdf
Computer Software - Technology and Livelihood Education
Designing Intelligence for the Shop Floor.pdf
Microsoft Office 365 Crack Download Free
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
Oracle Fusion HCM Cloud Demo for Beginners
Website Design Services for Small Businesses.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