OOP Lecture 01

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 23

Object Oriented

Programming

Java

1
Procedural Oriented
Programing (POP)
 Program is divided into small parts called
functions
 Importance is not given to data but to

functions as well as sequence of actions to


be done
 Does not have any access specifies

 In POP, Data can move freely from function

to function in the system

2
POP Cont…
 To add new data and function in POP is not
so easy
 In POP, Most function uses Global data for

sharing that can be accessed freely from


function to function in the system
 POP does not have any proper way for hiding

data so it is less secure


 In POP, Overloading is not possible

 Example of POPL are : C, VB, FORTRAN,

Pascal 3
Object Oriented
programing(OOP)
 Program is divided into parts called objects
 Importance is given to data rather than

procedures or functions to mimic real world


realm
 OOP has access specifies named Public,

Private, Protected, etc


 In OOP, objects can move and communicate

with each other through member


functions/methods
4
OOP cont…..
 OOP provides an easy way to add new data and
function/methods
 In OOP, data cannot move easily from function

to function, it can be kept public or private so we


can control the access of data
 OOP provides Data Hiding so provides more

security
 In OOP, overloading is possible in the form of

Function Overloading and Operator Overloading


 Example of OOP are : C++, JAVA, VB.NET,

C#.NET 5
POP SRUCTURE……
Main Function

Function 1 Function 2 Function 3

Function 2 Function 5

Function N

6
OOP SRUCTURE……
Class 1 { Class 2 {
Data Data
Methods Methods
} }

Class n {
Data
Methods
}

7
Java
 General purpose programming language
 Is simple

 Is scalable

 Is object oriented

 Is similar to C and C++

8
Java
A Programming Language and a Platform
 Java Platform
 Java Virtual Machine (Java VM)
 Java Application Programming Interface

9
Java
 It
is Platform Independent (Write Once Run
Anywhere)

10
Advantages of Java
 Easy to learn, Familiar C++ like syntax
 Pure Object Oriented Language
 Extensive API, which means that
programmers write lesser amount of code
 Extensive Documentation
 Faster Application Development because of
code re-use
 Platform Independence
 Automatic Garbage Collection

11
History of Java
 Project Green by Sun Microsystems to create
a pure object oriented language based on C+
+, to overcome the limitations and
complexities of C++ (1990)
 Aimed at embedded systems in consumer

electronic devices (interactive television,


VCR, washing machines, etc.)
 Originally named ‘Oak’

12
History of Java
 Failedto win recognition in embedded
systems and embedded systems were not
making a rapid progress
 During the same period world wide web

(www) was going through an exponential


growth
 Oak was aimed at supporting interactive web

pages together with the development of a


new web browser, Web Runner (1994)
13
History of Java
 ‘Oak’ renamed ‘Java’ and ‘Web Runner’
renamed ‘Hot Java’
 Formal Announcement of Java Language

and Hot Java browser in Sun World ’95


 Commercial web browsers starting with

Netscape begin supporting Java


 Later Java evolved into other technologies

like Java applets (interactive web content)

14
Use of Java
 Desktop Applications such as acrobat reader,
media player, antivirus etc.
 Web Applications such as irctc.co.in,

javatpoint.com etc.
 Enterprise Applications such as banking

applications.
 Mobile

 Embedded System

 Smart Card

 Robotics
15

 Games etc.
Different Java Technologies
 JVM (Java Virtual Machine): is an abstract machine.
It is a specification that provides runtime
environment in which java bytecode can be
executed.
 JVMs are available for many hardware and software
platforms. JVM, JRE and JDK are platform
dependent because configuration of each OS
differs. But, Java is platform independent.
 The JVM performs following main tasks:
 Loads code
 Verifies code
 Executes code
J2ME combines a resource constrained JVM and a set of
Java APIs for developing applications for mobile devices
16

 Provides runtime environment


Different Java Technologies
 JRE: is an acronym for Java Runtime Environment.
 It is used to provide runtime environment.
 It is the implementation of JVM.
 It physically exists.
 It contains set of libraries + other files that JVM uses at
runtime.
 Implementation of JVMs are also actively released
by other companies besides Sun Micro Systems.

J2ME combines a resource constrained JVM and a set of 17


Java APIs for developing applications for mobile devices
Different Java Technologies
 JDK is an acronym for Java Development Kit.
 It physically exists.
 It contains JRE + development tools.

J2ME combines a resource constrained JVM and a set of 18


Java APIs for developing applications for mobile devices
Different Java Technologies

J2ME combines a resource constrained JVM and a set of 19


Java APIs for developing applications for mobile devices
Different Java Technologies
 IDE’s (Integrated Development Environments): are
tools used for efficient software development
 Different Components of an IDE :
 Editor
 Linker
 Compiler
 Debugger
 All the different components are seamlessly
integrated in an IDE making it easy to use

J2ME combines a resource constrained JVM and a set of 20


Java APIs for developing applications for mobile devices
IDEs cont…
 For different programming languages,
different IDE’s are available
 Java Language :
JBuilder, Kawa, NetBeans, eclipse etc.
 C Language :
Borland C, Turbo C, etc.
 IDE’s have capabilities different from each
other and one has to learn the use of an IDE
to get the maximum return
J2ME combines a resource constrained JVM and a set of 21
Java APIs for developing applications for mobile devices
Compilation and Execution of
a Java Program
 Create a source file (e.g. :- a file named
“HelloWorld.java”) and type in the source code.
/**
* The HelloWorld class implements an application that
* displays "Hello World!" to the standard output.
*/
public class HelloWorld {
public static void main(String[] args) {
// Display "Hello World!"
System.out.println("Hello World!");
}
}

22
Compilation and Execution of
a Java Program
 Compile the source file
 Use the Java compiler :
javac HelloWorld.java
 A byte code file (i.e. a file understandable by the
Java Virtual Machine) is created
 Run the program contained in the byte code
file
 Use the command :
java HelloWorld
23

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