0% found this document useful (0 votes)
3 views21 pages

OOPs - Lecture 01 - 02 - Introduction

The document provides an overview of programming paradigms, specifically comparing procedural and object-oriented programming, with a focus on Java. It covers key concepts such as classes, objects, and the Java Development Kit (JDK), Java Runtime Environment (JRE), and Java Virtual Machine (JVM). Additionally, it highlights the differences between Java and C++, as well as Java's core principles and buzzwords.

Uploaded by

1originaltruth
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views21 pages

OOPs - Lecture 01 - 02 - Introduction

The document provides an overview of programming paradigms, specifically comparing procedural and object-oriented programming, with a focus on Java. It covers key concepts such as classes, objects, and the Java Development Kit (JDK), Java Runtime Environment (JRE), and Java Virtual Machine (JVM). Additionally, it highlights the differences between Java and C++, as well as Java's core principles and buzzwords.

Uploaded by

1originaltruth
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

Introduction

Lecture 01,02
Learning Outcome
After the completion of the session you will be able to:
• Analyze the difference between procedural and object oriented
programming.
• Identify the use of java.
• Discuss the concept of Class and Objects.
• Illustrate the working of jdk, jre, jvm and jit.
• Define various buzzwords in java.
Procedural Programming
Struc • Focus on improving the quality, development time and clarity of the code. [1]
tured • Uses control flow structures and iterations to write a code.
• First came into existence in 1950s with the language ALGOL 58 and ALGOL 60.
Progr
ammi
ng
• Derived from Structured Programming.
Proce • Make uses of procedures, also known as routines, subroutines or functions.[2]
dural • First came into existence in 1960s with the language Fortran, ALGOL, COBOL and Basic
Progr • Later in 1970s, Pascal and C were published
ammi
ng
Object Oriented Programming
 Make use of Classes and Objects to implement the real world
problems.
 Objects has their own data also known as attributes and Procedure
which is known as Method.[3]
 The methods of the object can be used to work on the data related
to the object.
 The main focus is to identify the objects and how they are related to
each other, so that it is easier to manipulate them.
 Some commonly used OOP language is Java, C++, C#, Ruby, Python
etc…
Procedural VS Object Oriented
Reason to differ Procedural Object Oriented
Basic Unit Functions Objects
Approach Top Down Bottom Up
Importance Sequence of action or function is Data is most important
more important than data
Update or addition Difficult to add new data or Easy to add new data or function
function
Access control Not present Implemented through Access Specifier.
Security Less secure because no data hiding Secure because of data hiding

https://freefeast.info/general-it-articles/difference-between-procedure-oriented-programming-and-object-orient
ed-programming-procedure-oriented-programming-vs-object-oriented-programming/
Java VS C++ [4]

Point of difference C++ Java


Memory management Done by developers using pointers Done by system without using pointers
Inheritance Support both single and multiple Does not support multiple inheritance*
Runtime error detection Programmer’s responsibility System’s responsibility
Portability Platform dependent – Write Once Platform independent – Write Once Run
Compile Anywhere Anywhere/Everywhere
Main components Uses Structures and Union Uses Threads and interfaces

*Multiple inheritance in java is implemented by interfaces


Classes
 A class is a blueprint or prototype from which objects are created.
 Classes are data types based on which objects are created.
 Objects with similar properties and methods are grouped together to form a Class.
 Thus a Class represent a set of individual objects.
 The actions that can be performed by objects becomes functions of the class and is
referred to as Methods.
Objects
 Object is the basic unit of object-oriented programming and are identified by its
unique name.
 An object represents a particular instance of a class.
 There can be more than one instance of an object.
 Each instance of an object can hold its own relevant data.
 An Object is a collection of data members and associated member functions also
known as methods.
 An object has:
• state - descriptive characteristics
• behaviors - what it can do (or what can be done to it)
Classes and Objects
Animals Class

Objects

Rabbit Tiger
State: Long ear, color State: color, stripes, Muscular
Behavior: Hop, Dig, Run Behavior: Hunting, Roar
Class, Object and Instance
 A class is a blueprint or prototype from which objects are created. E.g. Animal
 An object is a software bundle of related state and behavior. E.g. Rabbit
 An instance is a single and unique unit of a class. E.g. Rabbit1, Rabbit2, Rabbit3
Java Introduction
 Java - The new programming language developed by Sun Microsystems in 1991.
 Originally called “Oak” by James Gosling, one of the inventors of the Java
Language.
 Renamed as Java in 1995
 Sun Microsystems released the first public implementation as Java 1.0 in 1996
 The latest version of java is Java 23 which was released in September 2024.
 Java - The name that survived a patent search
 Java Authors: James Gosling, Bill Joy, Arthur van Hoff, Jonathan Payne, Frank
Yellin, and Tim Lindholm.

1
Java Introduction(contd…)
 Originally created for consumer electronics (TV, VCR, Freeze, Washing
Machine, Mobile Phone).
 Java - CPU Independent language
 Internet and Web was just emerging, so Sun turned it into a language
of Internet Programming.
 It allows you to publish a webpage with Java code in it.

1
Jdk [5]

 Java Development Kit (in short JDK) is Kit which provides the
environment to develop and execute(run) the Java program.
 JDK is a kit(or package) which includes two things
• Development Tools(to provide an environment to develop your java
programs)
• JRE (to execute your java program).
jre
 JRE stands for “Java Runtime Environment” and may also be written
as “Java RTE.”
 It is an installation package which provides environment to only
run(not develop) the java program(or application) onto your
machine.
 JRE is only used by them who only wants to run the Java Programs
i.e. end users of your system.
JVM
 Java Virtual machine(JVM) is a very important part of both JDK and
JRE because it is contained or inbuilt in both.
 Whatever Java program you run using JRE or JDK goes into JVM and
JVM is responsible for executing the java program line by line hence
it is also known as interpreter.
JIT
 The bytecodes are very important feature in java’s platform
independent concept.
 The way bytecodes get converted to the appropriate native
instructions for an application has a huge impact on the speed of an
application.
 These bytecode can be interpreted, compiled to native code or
directly executed on a processor whose Instruction Set Architecture
is the bytecode specification.
 The JIT compiler helps improve the performance of Java programs by
compiling bytecode into native machine code at run time.
The Bytecode
 It insures both security and portability problems.
 JVM(Java Virtual Machine) is an interpreter for bytecode.
 Only JVM needs to be implemented for each platform and it will
differ from platform to platform.
 Although java is developed to be interpreted but sometimes
compilation is required to boost performance.

1
Working of jre
Interaction of jdk and jre
The Java Buzzwords [6]

Simple
Architecture
Secure
Neutral

Multi
Portable
Threaded

Java
Object
Dynamic
Oriented

Distributed Robust

High
Interpreted
Performance

20
Reference
[1] https://en.wikipedia.org/wiki/Procedural_programming
[2] https://en.wikipedia.org/wiki/Structured_programming
[3] https://en.wikipedia.org/wiki/Object-oriented_programming
[4] https://www.educba.com/c-plus-plus-vs-java/
[5] https://www.geeksforgeeks.org/differences-jdk-jre-jvm/
[6] Java -The complete reference, 12th edition by Herbert Schildt

You might also like