You are on page 1of 20

Lecture 02

OBJECT ORIENTED PROGRAMMING


CST 124-2
Department of Computer Science & Technology

nisal@uwu.ac.lk
Object Oriented Programming
• When you write a program using an Object Oriented
Programming Language you are creating a model of some part of
the real world, in your computer.
• The model is built up considering the objects that appear in the
problem domain.
Real world object Software model of the object

States Behaviours
Colour Driven
Model Braked
Price Horned
Manufactured Year Turned
Mileage Reversed
Content
• Evaluation of Java
• Features of Java
• Installing, Configuring & Implementing Java
• Java Development Kit (JDK)
• Java Virtual Machine (JVM)
• First program in Java
• Compiling & Executing a Java Program
Evaluation of Java
• James Gosling, Patrick Naughton, Chris Warth, Mike Sheridan, and
Ed Frank initiated the Java language project in June 1991.
• The objective was to develop a programming language which was
platform-independent and which could create embedded
software for consumer electronic devices like TVs, VCRs etc.
• It took 18 months to develop and had an initial name
as Oak which was renamed to Java in 1995.
• Java originally was developed by the team led by James Gosling at
Sun Microsystems (which has merged with the Oracle
Corporation) and released in 1995.
• JDK 1.0 released in January 23, 1996.
• Java SE 20 is a current most updated and stable release of Java.
Version Date
JDK1.0 January 23, 1996

JDK 1.1 February 19, 1997

J2SE 1.2 December 8, 1998

J2SE 1.3 May 8, 2000

J2SE 1.4 February 6, 2002

J2SE 5.0 September 30, 2004

Different Java SE 6 December 11, 2006

Java SE 7 July 28, 2011


releases Java SE 8 March 18, 2014
of Java with
the released
year Java SE 13 September 17, 2019

Java SE 14 March 17, 2020

Java SE 15 September, 2020

Java SE 16 March, 2021

Java SE 17 (LTS) September, 2021

Java SE 18 March, 2022

Java SE 19 September, 2022

Java SE 20 March, 2023


Features of Java
• Simple : Java is simple to learn
• Object-oriented : In Java, everything is an Object
• Secure : Java has secure features that enables to develop virus-free systems
with more advanced authorization techniques
• Robust : Java provides compile time error checking and runtime checking to
eliminate errors and provide reliable code
• Distributed : Java can create network applications that can share both data
and programs
• High performance : Provides Just-In-Time compilers, that enables high
performance
• Dynamic : Java enables to link new class libraries, methods and objects
dynamically at runtime
• Both compiled & interpreted : Java compiler first compiles source code
into a byte code, then in the second stage Java Interpreter generates a
machine code that can be executed by the machine that is running the
Java program
• Platform Independent : When Java code is compiled, it is not compiled
into a platform specific machine code, rather into a platform
independent byte code
Four Pillars of OOP
• Encapsulation : Wrapping up data and methods together into a single
unit (class).
• Abstraction : The process of showing only essential/necessary features of
an object and hide the other background information.
• Inheritance : The ability of creating a new class from an existing class.
Here an object acquires the property of another object.
• Polymorphism : Polymorphism is the ability of an object to exist in many
forms.
• In Java Polymorphism is considered into two versions.
• Compile time / Method overloading / Static binding
• Runtime time / Method overriding / Dynamic binding
The Top Programming Languages of 2022

Source : https://spectrum.ieee.org/
Installing, Configuring & Implementing Java
• Tools needed;
• JDK (Java Development Kit) : a software development
environment used for developing Java applications and applets.
It includes the Java Runtime Environment (JRE), an
interpreter/loader (Java), a compiler (javac), an archiver (jar), a
documentation generator (Javadoc) and other tools needed in
Java development.
• A text editor
First Program in Java
public class Hello
{
public static void main (String[] args)
{
System.out.print(“Hello World!”);
}
}

• Important : Save the file using the class name. (Hello.java)


Compiling & Executing a Java Program
• To Compile :
javac Hello.java

• To Execute :
java Hello

You might also like