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

comp1

The document introduces Object Oriented Programming (OOP) concepts and the BlueJ IDE for Java, explaining key terms such as classes, objects, and functions. It outlines the basic principles of OOP including data abstraction, encapsulation, polymorphism, and inheritance, emphasizing the advantages of reusability. Additionally, it compares compilers and interpreters, defines source code, object code, and byte code, and discusses the Java Virtual Machine (JVM) and Java packages.

Uploaded by

emanueljohny2023
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

comp1

The document introduces Object Oriented Programming (OOP) concepts and the BlueJ IDE for Java, explaining key terms such as classes, objects, and functions. It outlines the basic principles of OOP including data abstraction, encapsulation, polymorphism, and inheritance, emphasizing the advantages of reusability. Additionally, it compares compilers and interpreters, defines source code, object code, and byte code, and discusses the Java Virtual Machine (JVM) and Java packages.

Uploaded by

emanueljohny2023
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CHAPTER – 1

INTRODUCTION TO OBJECT ORIENTED PROGRAMMING CONCEPTS


BlueJ - is an Integrated Development Environment (IDE) for java programming language. That
means an interface to type, edit and execute java programs. BlueJ runs with the help of JDK.

JDK - The Java Development Kit (JDK) is a software development environment that offers a
collection of tools and libraries necessary for developing Java applications.

Definition of Object Oriented Programming (OOP)

Object Oriented Programming is a modular approach in which stress is laid on data


rather than functions. The data values (variables) remain associated with the functions of a
particular block of the program so as to encourage data security

Features of OOP

 Data values are secured


 Error detection and correction becomes easier
 Easier in coding complex programs

CLASS
OBJECT1 OBJECT2 OBJECT3

FUNCTION FUNCTION FUNCTION

DATA DATA DATA

Class

A class is a blue print of an object. It is also known as object factory.

Object

It is a unique entity which contains data and functions (characteristics and behaviour)
together.

Function

A program module (a part of program) used at different instances in a program to


perform a specific task is known as a function

Basic Principals of OOP

Data Abstraction
The act of representing the essential features , without knowing the background
details
Encapsulation
Wrapping of data and functions of an object as a single unit that can be used in a
specific operation
Polymorphism
Using a single function to carry multiple tasks
(In java, polymorphism is implemented using function overloading)
Inheritance
To link and share some common properties of one class with another class
(This feature promotes reusability)

What is Reusability?

With the help of Inheritance, the components in the Base (Parent, Super) class can be
reused to perform some other task in Derived (Child, Sub) class. This phenomenon is termed
as Reusability

Advantages of Reusability

 Allows less time in writing a program


 Takes less memory space for storage
 Enables program execution faster

Difference between Compiler and Interpreter

Compiler Interpreter
1. It converts the whole source 1. It converts the source program into
program into the object program at the object program one line at a time.
once.
2. It displays the errors for the whole 2. It displays the errors of one line at a
program together, after compilation. time and only after debugging that
error the control goes to the next line.
3. Compiler is faster than interpreter 3. Interpreter is slower compared to
compiler

Define

Source code - Program written in high level language

Object code – Program in machine language

Byte code – Intermediate code formed when a java source code is converted to
machine language

Compiler Java Interpreter / JVM Machine compactible


Java source code Byte Code
language

What is JVM (Java Virtual Machine)?

JVM is java interpreter that converts byte code into machine code suitable to a specific
platform. Though its software, due to its nature of conversion of byte codes from multiple
source codes, it is referred to as a virtual machine.
Why java is called platform independent?

When the Java program runs in a particular machine it is sent to java compiler, which
converts this code into intermediate code called bytecode. JVM recognizes the platform it is on
and converts the bytecodes into native machine code. Hence java is called platform
independent language.

What is a Package?

Java package is a collection of various classes.

eg – java.util

java.lang (default package in java)

What are reserved words?

These are keywords in java which carry special meaning to the system compiler.

eg - public

class

Name the different types of java programming.

 Java Application (Stand Alone programs)


 Java Applets (Internet Applets)

Basic Structure of Java Program

class Declaration of class

{ Opening of class

public static void main (String args[ ]) Declaration of main function

{ Opening of main function

------------------
Body of the program which consists of
------------------- Input -- Process -- Output

} Closing of main function

} Closing of class

Note – when a message is to be displayed along with a variable, they must be


separated with „+‟ (plus) sign

eg – System.out.println ( “ The sum is = ” + s)

_________________

You might also like