Oop 1
Oop 1
Oop 1
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.
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
• 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.