EEI3262
Introduction to
Object Oriented Programming
Day School – 01
What is programming?
Programming is the implementation of logic to
facilitate specified computing operations and
functionality. It occurs in one or more languages,
which differ by application, domain and
programming model.
~Techopedia
What is a Programming
Paradigm ?
A programming paradigm is a pattern, basic
discipline or a way of thinking of programming
a computer.
Programming Paradigms
• Declarative (Logical) Paradigm
• Imperative Paradigm
• Functional Paradigm
• Object Oriented Paradigm
And there are many more -Parallel processing, etc..
(Further details on the paradigms are explained in EEX3467)
Additional reference - http://www.cs.ucf.edu/~leavens/ComS541Fall97/hw-pages/paradigms/major.html
Why OOP Paradigm?
• Faster and easier to execute
• Provides a clear structure for the programs
• Helps to keep the Java code DRY "Don't
Repeat Yourself", and makes the code easier to
maintain, modify and debug
• Makes it possible to create full reusable
applications with less code and shorter
development time
Classes and Objects
• We can develop software by breaking the application
into its component objects. These objects will interact
with each other and perform the required
functionality of the software.
• In OOP, a program needs to be seen as a collection of
objects.
• Each object can be viewed as an independent entity
and these objects have their own discrete tasks to
perform.
Activity 1- Live quiz
Go to the LMS course
and
do the Quiz named
“Day School 01 - On Session Activity 1 - Quiz
(under “Day School 01” topic)
5 minutes
Object Oriented Programming –
Real World Example
A class is the blueprint(plan) an object is created.
Class Object
Car Corolla
Aqua
Leaf
Activity 2- Group Activity
• Decide a Group Name
• Search the internet and find answers to the topics
- A Brief History of Object-Oriented Programming
- Evolution of Object-Oriented Programming languages.
- List of Object-Oriented Programming languages
• Go to the LMS activity named “Day School 01 - On session Activity 2”
• Post the answers as groups.
• Group leader posts the part of the discussed content. Other group
members add the rest of the discussed content as replies to that Post.
20 minutes – breakout rooms
Object Oriented Programming
languages
• C+
• Java
• C#
• Python
What is Java ?
• Java is a general-purpose Object-Oriented
high-level programming language.
• Java is simple, reliable, secure and portable
which can run on Windows, Linux, MacOS
and many other operating systems.
Java Virtual Machine (JVM)
• Programs written in Java are compiled into
machine language for the JVM.
• The machine language for the Java Virtual Machine
is called Java bytecode.
• Use of a virtual machine allows an application to
run on any computer.
• All that the computer needs is an interpreter for
Java bytecode.
Just-In-Time
(JIT) Compiler
A just-in-time compiler
translates Java byte
code into native
machine language.
It does this while it is
executing the
program.
Key features of Java Language
• Class • Data types
• Object • Keywords
• Method • Operators
• Variable
A simple Java Program
public class greetings{
public static void main(String[] args){
System.out.println(“Hello World!”);
}
}
Class
Main.java
Create a class named "Main" with a variable x:
public class Main {
int x = 5;
}
Object
Example
Create an object called "myObj" and print the value of x:
public class Main {
int x = 5;
public static void main(String[] args) {
Main myObj = new Main();
System.out.println(myObj.x);
}
}
Method
2 4
public int add(int num1,int num2)
1 3
KeyWords
Input/Outputs
Outputs
●System.out.println(); or
●System.out.print(); or
●System.out.printf();
Inputs
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
Variables
• Temporary memory locations to store data
• Volatile by nature
• In java variables are strongly typed; meaning they can only store a
specific type of data and this type cannot be changed later.
• Variables are declared by specifying their type and a name (which
we call the identifier)
int x;
• Variable initialization refers to storing a value for the first time in a
variable.
int y;
y = 10;
OR
int z = 25;
Variables
“vary + able”
Data Types in Java
• Primitive data types: The primitive data types
include boolean, char, byte, short, int, long, float
and double.
• Non-primitive data types: The non-primitive data
types include Classes, Interfaces, and Arrays.
Primitive Data Types
Data Types
Identifiers in Java
Identifiers in Java are symbolic names used for
identification.
Operators
Java Programming Environment
• Java Runtime Environment (JRE)
• Java Development Kit (JDK)
The environment for programming should be set
before start writing a program.
Java Runtime Environment(JRE)
• The Runtime can be used to run Java programs, but
it does not allow you compile your own Java
programs.
Java Development Kit(JDK)
• The basic development system for Java
programming is usually referred to as the JDK.
• It is a part of Java SE, the Java "Standard Edition" .
• The Development Kit includes the JRE, but also lets
you compile programs.
You need to install a JDK to use with this course.
Practical
Let’s Download and Install the
JDK Now !!!
End of Day School 01
Thank You!