Oop 1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Principles of Object Oriented Programming,

(Difference between Procedure Oriented


and Object oriented). introduction to JAVA •
Types of java. progrøms• Applets
Applications, Java Compiletion process, Java
Source eodé, Byte code, Object code, Java
Virtual Machine (JVM), Features of JAVA.

Introduction
to Object
Oriented
Programming
concepts
Department of ICT
AVS
Objecu»vlented programming: Obiect
Programming ()OPScoforsto that object;
Object moans a teal wovl(ientity such a pen, (hmr, computer, wot(h, etc Object.
Oriented Programming a method010/Y Of
paradigm to dosjgn a program and ohtects.
oriented aims to implement veal world entities like inheritance, hiding, polymorphismetc , in
pt The main aim ot OOP is to bind together the data and the fonctione,that operate on thorn so that
no othev patt of the code can access this (Inta except that function.

Procedure.oriented programming: Both Procedural Oriented Programming (POP) and Object


mqvamming (OOP) ate the high level languages programming world and ore Widely used in developmentof
applications. Procedural Programming can be defined as a procramming model which is derived from structured
programming, based upon the concept of calling procedure. Procedures. also known as routines, subroutine;
functions, simply consist of a series of computational steps to be carried out.

Eyample: FORTRAN, COBOL, BASIC etc.


Difference between Procedural Programming and Object Oriented Programming:

Procedural Programming Object Oriented programming


is divided
In procedural programming, program is divided into In object oriented programming,program
small arts called unctions. into small arts called 0b ects.
follows bottom up
procedural programming follows top down approach. Object oriented programming
approach.
programming have access specifiers
There is no access specifier in procedural Object oriented
ro ramming.. like rivate, ublic, rotected etc.
Adding new data and function is not eas Adding new data and function is eas
More Secure and Supports Overloadin
Less secure and do not sup orts Overloadin data is more
In object oriented programming,
In procedural programming, function is more on real world.
im ortant than function and based
im ortant than data and based on unreal world.
Exam les: C++, Java, Python, etc.
Examples: C, FORTRAN, Pascal, Basic etc.

ro rammin Ian ua e
Advanta e of OOPs over Procedure-oriented language,
r, whereas, in aprocedure-oriented programming
and maintena
1) OOPs makes development
code grows as project size increases.
it is not easy to manage if can be
a procedure-oriented programminglanguage, global data
whereas, in
2) OOPs provides data hiding,
accessed from anywhere. providethe solutionof
more effectively.we can
ability to
3) oops provides the Object-Oriented Programming
language.
if we are using the
real word problem
Oriented Pro rammin
Princi les of 0b ect essential features without including
the background
refers to the act of
representing parts, but as an object
Abstraction: Abstraction think a car as composed of thousands of
For example, we do not
details or explanations.
single unit called
of and methods (functions)into a
up access by the
Encapsulation is an act of wrapping The insulation of the data from direct
Enca sulation: concepts of OOP.
most fundamental
is onneof the
sttö\' of
ternu•d data hiding. apsolntion
abstraction

is Ili€' by which objects of one class acquire the of ot)lect€,of another


Class. make of existing den vine,
reusabilityo' codes i.e.
a new class throtll';hinhentance.
polymorphisyyy;
Polymorphismallowstwo or more classes to respond to the same in different way',
same natne fot a method can be used in two different classes or in the sarne also the user can send
the same to two different classes.
of OOP:

• Elimination of redundant coding system and usage of existing classes through inheritance.
Security of data values from other segments of the program through hiding„
• Possibility of co-existence of multiple instances of an-object without any interference.

INTRODUCTION TO JAVA
What is JAVA?
Java is a programminglanguage and computing platform first released by Sun Microsystems in 1995. Java is
a general-purpose programming language that is class-based, object-oriented, and designed to have as few
implementationdependenciesas possible. It is intended to let application developers write once, run
anywhere (WORA), meaning that compiled Java code can run on all platforms that support Java without the need
for recompilation. Java applications are typically compiled to bytecode that can run on any Java virtual
machine (JVM) regardless of the underlying computer architecture.
Java is a pure Object Oriented language, in which all the functionalities revolve around the classes and objects
All Java programs contain objects that interact with each other by calling methods.
Without a class, there can be no objects and without objects, no computation can take place in Java. Thus, a class
is the basis of all computations in Java.
Basic Features of Java: -
• Write once run anywhere(WORA)
• Platform Independent
• Offers many security features to make its programsafe and secure
• Built in graphics & supports multimedia
• Light Weight code
• Open Product... i.e., freely available to all.
Different Types of Java Programs
1) Standalone Application —An application program that is developed by programmers
which consists of
various methods and these methods being invoked from within a 'main ( )' method
is called standalone
application.

Page 1
2) Internet Applets These are small java programs that are embedded in a web page and which requires
a web browser to be run/executed.
3) Servlets —They extend the functionality of web browser.
Source Code: The High level language code written by programmerswhich is not understandableby the
computer is known as Source Code. It has an extension of
Java Byte Code: is an intermediate code that consists of a set of pseudo machine language instructions that are
understood by the JVM and are independentof the underlyinghardware. It is called byte code because each
chunk of code is of 8 BITS (1 byte = 8 Bits).
The byte code files have an extension of •.class
Object Code: Object codeis the resultof compilationof a moduleor programwrittenin a programming
language, stored for later use. Java virtual machine produces machine code. Object code is a portion of the
resulting machine code. Bytecode becomes object code at JIT (Just in time compilation) time.
JVM: The Java Virtual Machine (JVM) is the runtime engine of the Java Platform, which allows any program
written in Java or other language compiled into Java bytecode to run on any computer that has
a native JVM.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy