📢 Join My WhatsApp Channel JavaWithSumit

Get Daily ICSE Java Notes, Programs & Exam Tips 🚀

👉 Join Now

Introduction to Object Oriented Programming and Java- ICSE Notes

 

Introduction to Object Oriented Programming and Java – ICSE

Introduction

Object Oriented Programming (OOP) is a modern programming approach in which a program is designed using objects and classes. Java is a popular object-oriented programming language widely used in schools, colleges, and the software industry.
This chapter helps students understand the basic concepts of OOP and Java, which form the foundation of advanced programming.


1. Principles of Object Oriented Programming

Object Oriented Programming is based on four main principles:

  1. Abstraction

  2. Encapsulation

  3. Inheritance

  4. Polymorphism


Procedure Oriented Programming vs Object Oriented Programming

Procedure Oriented ProgrammingObject Oriented Programming
Program is divided into functionsProgram is divided into objects
Data is not well protectedData is well protected
Less secureMore secure
Example: C languageExample: Java, C++
Reusability is lessReusability is high

1. Abstraction

Definition:
Abstraction means showing only essential features of an object and hiding the unnecessary details.

Real Life Example:
An ATM machine allows users to withdraw money but hides internal processing like verification and calculations.

Importance:

  • Reduces complexity

  • Makes programs easier to use


2. Encapsulation

Definition:
Encapsulation is the process of binding data and methods together into a single unit called a class.

Real Life Example:
A medicine capsule contains medicines safely enclosed inside it.

Advantages:

  • Provides data security

  • Prevents misuse of data


3. Inheritance

Definition:
Inheritance is the process by which one class acquires the properties and methods of another class.

Real Life Example:
A child inherits qualities and properties from parents.

Advantages:

  • Code reusability

  • Saves time and effort


4. Polymorphism

Definition:
Polymorphism means one name, many forms. The same method can perform different tasks.

Real Life Example:
A person behaves differently as a student, son, or friend.

Advantages:

  • Increases flexibility

  • Improves code readability


2. Introduction to Java

Java is a high-level, object-oriented programming language developed by Sun Microsystems. It is widely used because of its simplicity, security, and platform independence.


Types of Java Programs

1. Java Applications

  • Standalone programs

  • Use the main() method

  • Run on desktop systems

Examples:
Calculator, Text Editor


2. Java Applets

  • Small Java programs that run inside a web browser

  • Do not use the main() method

  • Require a browser or applet viewer

Note: Applets are now outdated but still included in ICSE syllabus.


Java Compilation Process

Steps Involved:

  1. Java Source Code (.java file)

  2. Java Compiler (javac)

  3. Byte Code (.class file)

  4. Java Virtual Machine (JVM)

  5. Output


Java Source Code

The program written by the programmer in Java language is called source code.
It is saved with the extension .java.


Byte Code

The intermediate code generated by the Java compiler is called byte code.
It is platform-independent and stored in .class files.


Object Code

Object code is machine-dependent code that can be directly understood by the computer hardware.


Java Virtual Machine (JVM)

Definition:
JVM is a virtual machine that converts byte code into machine code and executes it.

Functions of JVM:

  • Executes Java programs

  • Manages memory

  • Provides security


Features of Java

  1. Simple – Easy to learn and use

  2. Object Oriented – Based on OOP concepts

  3. Platform Independent – Write once, run anywhere

  4. Secure – Safe from viruses

  5. Robust – Strong error handling

  6. Portable – Easily transferable

  7. Multithreaded – Performs multiple tasks simultaneously




Most Important Questions 

Short Answer Questions – Answers

1. Define Object Oriented Programming.

Object Oriented Programming (OOP) is a programming approach in which a program is designed using objects and classes. It focuses on data and the operations performed on that data.


2. What is Abstraction? Give one real-life example.

Abstraction is the process of hiding unnecessary details and showing only essential features of an object.
Example: An ATM machine allows the user to withdraw cash without showing the internal processing.


3. Define Encapsulation.

Encapsulation is the process of binding data and methods together into a single unit called a class. It helps in protecting data from unauthorized access.


4. What is Inheritance?

Inheritance is a mechanism in which one class acquires the properties and methods of another class, allowing code reuse and reducing duplication.


5. What is Polymorphism?

Polymorphism means one name, many forms. It allows the same method or function to perform different tasks in different situations.


Long Answer Questions – Answers


1. Explain the four principles of Object Oriented Programming with real-life examples.

The four principles of Object Oriented Programming are:

1. Abstraction:
It shows only important details and hides unnecessary information.
Example: ATM machine.

2. Encapsulation:
It binds data and methods into a single unit.
Example: A medicine capsule.

3. Inheritance:
It allows a class to inherit properties from another class.
Example: Child inheriting qualities from parents.

4. Polymorphism:
It allows one method to perform multiple functions.
Example: A person acting as a student, son, and friend.


2. Differentiate between Procedure Oriented Programming and Object Oriented Programming.

Procedure Oriented ProgrammingObject Oriented Programming
Focuses on functionsFocuses on objects
Data is less secureData is more secure
No data hidingSupports data hiding
Example: CExample: Java, C++

3. Explain the Java Compilation Process with a diagram (description).

The Java compilation process involves the following steps:

  1. The programmer writes the Java source code (.java).

  2. The source code is compiled using the Java Compiler (javac).

  3. The compiler converts source code into byte code (.class).

  4. The Java Virtual Machine (JVM) converts byte code into machine code.

  5. The program is executed and output is displayed.


4. What is JVM? Explain its functions.

JVM (Java Virtual Machine) is a virtual machine that executes Java byte code and converts it into machine-readable code.

Functions of JVM:

  • Executes Java programs

  • Manages memory

  • Provides security

  • Makes Java platform independent


5. Describe the features of Java.

The important features of Java are:

  1. Simple: Easy to learn and understand

  2. Object Oriented: Based on OOP principles

  3. Platform Independent: Write once, run anywhere

  4. Secure: Protects against viruses and threats

  5. Robust: Strong error handling

  6. Portable: Can run on any system

  7. Multithreaded: Performs multiple tasks at the same time

Mind Map is: 





Comments

Popular posts from this blog

Introduction to OOP's

Object Modelling – Entities and Their Behaviour in Java