The history and
Overview of Java
Object Oriented Programming BS (AI) II
Spring 2025
By
Muhammad Raees
• Assessment (Theory 100 Marks)
• 30% Mid Term
• 30% Sessional:
• 50% Project
Introduction • 50% Quiz
• Course Outlines
to Course • As per policy 75% Attendance in mandatory for appearing in Final Term
Exam, and there will be no compromise on attendance.
• Assignments Should be submitted on due time.
• Quiz will not be retaken.
• Best of total 3 – 6 may be counted and can be given presentation
Trade-offs in
language design
• Ease of use vs power
AdaLoveLace
• First program on Birth of C
paper • Bell Telephone
• Built for Difference Laboratories, Dennis Python
Engine Ritchie
History of 1949 1983 1995
Programming 1843 1972 1991
Assembly Birth of OOP Java:
Language • C++(Bjarne • James Gosling
• Simplified the 0’s and Stroustrup)
1’s
Assembly, Basic, Pascal, Fortran, COBOL…
• All relied on GOTO
History of Birth of modern programming: C
• 1970 BCPL
Java • Formalized in 1989 as C with adoption of ANSI
The next step: C++
• In Bell Labs 1979
History of Java
The Java creation
• 1991 by James Gosling and Co. at
Sun Microsystem
• Initially named as Oak, went through
a name “Green” and finally in 1995
renamed to Java
Primary motivation
• Platform independence
• Consumer Electronics
• Java is a high-level, general-
purpose, object-oriented, and
secure programming language
What is Java? used for creating wide variety of
software programs
Editions of Java
Java Standard Edition (JSE): Programs for Desktops
Java Enterprise Edition (JEE): Programs for servers
Programs for small devices:
Java Micro Edition (JME): • Set Top Boxes
Standalone Applications
Types of Enterprise Applications
Java
Applications Web Applications
Mobile Applications
Bytecode — the
magic of Java
(WORA)
A.java
A.class
Bytecode — the magic of Java (WORA)
• Java Code is compiled(javac) into byte code
• .class file is produced
• .class or bytecode:
• Interpreted by java compiler to produce machine code
JDK:
• Java Development Kit
• Contains all set of necessary tools to work with java
JRE:
JDK,JRE • Java Run-Time Environment
• Includes JVM
AND JVM • Environment to execute a java program
JVM:
• Software in form of interpreter
• Written in C Language
• Executes bytecode
JDK:
• JRE+JVM+Development Tools
• Programmers and students (Java
JVM, JRE Developers)
AND JDK JRE:
• JVM+Libraries
• Bytecode can be directly executed
How Java
Works?
Java Buzzwords
1. Simple
a) Easy to understand and use
b) Complex concepts like pointers are eliminated
2. Secure:
a) No pointers and memory conflicts
3. Portable
a) Bytecode can be carried to any platform
4. Object-oriented
a) Every thing is object (Dog, Chair, etc)
5. Robust (memory management, exception handling, reliability)
6. Architecture-neutral (write once; run anywhere, anytime, forever)
7. Interpreted and High Performance (JIT, no compromise on
performance)
Servlets
• Dynamic Web Pages:
• Generate change content according
to request
• Java Servlet allows Dynamic Web
Pages
• Server side programs
• Handle the request, process and
send back the response
OOP (Programming Paradigm)
• Object-Oriented Programming (OOP) is a
programming paradigm that organizes software
design around the concept of classes and objects.
Object:
• Object is real world entity:
• Dog,Chair,Laptop
Classes and • Easy to develop programs using real world entities
Objects Class:
• Class is a template or blueprint through which
objects of different types are created
• Animal, Furniture,Computer
Characteristics of an Object
• An object has state, behavior and identity
• State:
• Data values of an object, like legs of a
dog
• Behavior:
• Functionality of an object like barking
of dog
• Identity:
• Unique id for each object
• Used by JVM for unique identification
Encapsulation
Inheritance
OOP
Principles Polymorphism
Abstraction
An Overview of Java
Code: “Hello
World”
class Simple{
public static void main(String args[])
{
System.out.println("Hello Java");
}
}
Code: “VariablesDemo”
print println comments multiline block of code
comments
Concatenate string value with a numeric
value
The Numeric value is
converted to string
It works in java
before the
concatenation occurs
Second Short Program
Changing the flow of execution
Introduction of
Repetitions
Block of code
• Two or more statements form a code block
• A program is collection of Lexicons:
• Whitespaces
• Identifiers
• Literals
Lexical Issues • Comments
• Operators
• Separators
• Keywords
• Java is a free-form language
• Don’t worry about line breaks
• Start on one line, end several lines below
Whitespace • Whitespace include,
• Space
• Tab
• Newline
• Names of variables, methods, classes etc..
• Allowed
• Uppercase lowercase letter
•
Identifiers •
Numbers (must not be before char)
Dolor sign ($)
• Underscore (_)
Literals
• Single line //
Comments • Mutiline /* */
• Documentation comments /** */
Separators
Keywords
Java Class • java.lang.*
Libraries • System class