Dawn's Computer Academy logo Dawn's Computer Academy

ICSE CLASS IX · JAVA PROGRAMMING

Introduction to Object Oriented Programming Concepts

Understand the basic ideas behind object-oriented programming, explore everyday examples, revise important terms and test your knowledge.

1. Learning Objectives

After studying this chapter, you should be able to:

  • Explain the meaning of a computer program and programming paradigm.
  • Understand the basic difference between procedural and object-oriented programming.
  • Define object-oriented programming (OOP).
  • Explain abstraction, encapsulation, inheritance and polymorphism at an introductory level.
  • Recognise real-life examples of object-oriented concepts.
Study tip: First understand the concepts using everyday examples. You will study the detailed structure of Java classes and objects in the next part.

2. What Is Programming?

A computer program is a set of instructions written to make a computer perform a particular task.

Programming is the process of designing, writing, testing and maintaining those instructions using a programming language.

Example

A program can calculate the total marks of a student, display a result, manage a library or process a bank transaction.

A programming paradigm is an approach or style used to design and organise a program.

3. Programming Approaches

3.1 Procedural Programming

In procedural programming, a program is organised around procedures or functions that perform specific tasks. The instructions generally describe the steps needed to solve a problem.

Examples of procedural programming languages include C and BASIC, although many languages support more than one programming style.

3.2 Object-Oriented Programming

Object-oriented programming organises a program around objects that combine data with operations that work on that data.

Java is primarily an object-oriented programming language. Its programs commonly use classes and objects to represent entities and their behaviour.

Remember: Procedural programming focuses on procedures and steps, while object-oriented programming organises code around objects and their interactions. This is a simplified comparison; real programming languages can support multiple approaches.

4. What Is Object-Oriented Programming?

Object-Oriented Programming (OOP) is a programming approach in which software is designed using objects containing data and the operations associated with that data.

For example, a student object could contain a student's name, roll number and marks. Operations associated with the student could calculate total marks or display a result.

Why use OOP?

  • Organisation: Related data and operations can be grouped together.
  • Reusability: Classes and methods can be reused in suitable situations.
  • Maintainability: A well-designed program can be easier to update and test.
  • Modularity: A large program can be divided into smaller, understandable components.

5. Main OOP Concepts

5.1 Abstraction

Abstraction means focusing on essential features while hiding unnecessary implementation details.

Everyday example: When using an ATM, you select an operation and follow the instructions without needing to understand the internal banking system.

5.2 Encapsulation

Encapsulation means combining data and the methods that operate on that data within a single unit, such as a class. In Java, access control can help protect an object's internal state.

Everyday example: A bank account can combine its balance with operations such as depositing and withdrawing money. A well-designed account controls how its balance is changed.

5.3 Inheritance

Inheritance allows a new class to derive properties and behaviour from an existing class. It can help reuse and extend code.

Everyday example: A general Vehicle class might describe common features. A Car class could extend it with car-specific features.

5.4 Polymorphism

Polymorphism means “many forms”. In OOP, the same operation or interface can have different behaviour in different contexts.

Everyday example: A general instruction such as “make a sound” could result in a dog barking or a cat meowing, depending on the object.

5.5 Classes and Objects — A Preview

A class defines the structure and behaviour of a category of objects. An object is an instance of a class.

Example: A Student class is like a general design. Individual students, each with their own name and roll number, can be represented as objects of that class.

Classes and objects are introduced here to help explain OOP. Their detailed treatment belongs to the next part of your chapter sequence.

6. Procedural Programming vs OOP

BasisProcedural ApproachObject-Oriented Approach
Main organisationProcedures or functionsClasses and objects
Main focusSteps and operationsObjects, their data and behaviour
Data organisationData is handled by procedures; organisation varies by language and designData and related methods can be grouped in classes
Code reuseCan reuse functions and modulesCan reuse classes, methods and inheritance where appropriate
ExamplesC, traditional BASICJava, C++

Important: This table presents the basic classroom distinction. The features of a particular language depend on its design, and some languages support both approaches.

7. Everyday Examples of OOP

Example 1: School Management

  • Data: student name, roll number and marks.
  • Behaviour: calculate total, calculate average and display result.
  • Possible object: one particular student.

Example 2: Bank Account

  • Data: account number and balance.
  • Behaviour: deposit, withdraw and display balance.
  • Encapsulation helps control access to the balance.

Example 3: Shape

  • Different shapes can have different area calculations.
  • A common operation such as calculateArea() can behave differently for different shapes.
  • This illustrates the basic idea of polymorphism.

Example 4: Vehicle

  • A general Vehicle class could contain common features.
  • Car and Bike classes could extend the general class.
  • This illustrates the idea of inheritance.

8. Quick Revision

TermMeaning
ProgrammingDesigning and writing instructions to solve a problem.
Programming paradigmAn approach to organising and designing programs.
OOPA programming approach organised around objects.
AbstractionFocusing on essential features and hiding unnecessary details.
EncapsulationCombining data and related methods in a unit.
InheritanceDeriving a class from another class.
PolymorphismAllowing an operation or interface to have different forms of behaviour.
ClassA definition used to create objects.
ObjectAn instance of a class.

9. Practice Exercises

A. Short-answer questions

  1. What is a computer program?
  2. Define a programming paradigm.
  3. What is object-oriented programming?
  4. Explain abstraction with one everyday example.
  5. What is encapsulation?
  6. Explain inheritance with an example.
  7. What is polymorphism?
  8. State two possible advantages of OOP.

B. Application questions

  1. Identify possible data and behaviour for a Library Book object.
  2. How can a Car class reuse common features of a Vehicle class?
  3. Give an example where the same operation has different behaviour for different objects.
  4. Explain the difference between a class and an object using a student example.
Show suggested answers
  1. A computer program is a set of instructions that makes a computer perform a task.
  2. A programming paradigm is an approach to designing and organising programs.
  3. OOP is a programming approach organised around objects that combine data and related operations.
  4. Abstraction focuses on essential features while hiding unnecessary details; an ATM is one example.
  5. Encapsulation groups data and related methods into a unit such as a class.
  6. Inheritance allows a new class to derive features and behaviour from an existing class.
  7. Polymorphism allows the same operation or interface to behave differently in different contexts.
  8. Possible advantages include code organisation, reuse, modularity and easier maintenance.
  9. Possible data: book title, author and ISBN. Possible behaviour: issue, return and display details.
  10. A Car class can extend a Vehicle class and add car-specific features.
  11. A sound operation may make a Dog object bark and a Cat object meow.
  12. A Student class is a definition; a particular student with a name and roll number is an object.

These are suggested answers. Other correct explanations and examples are acceptable.

10. Interactive MCQ Quiz

Answer all 10 questions, then click Submit Quiz to see your score and feedback.

Well Done!

You have completed the introductory notes on Object Oriented Programming Concepts.

Next, continue with Part II: Elementary Concept of Objects and Classes.

Back to ICSE Java Ask Your Teacher