SlideShare a Scribd company logo
OOPS and JAVA
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 1
Programming Language
 A programming language is a computer language
programmers use to develop applications, scripts, or
other set of instructions for a computer to perform
specific tasks.
 The commonly used programming methodologies are:
 Procedural programming
 Object-oriented programming (OOP)
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 2
Procedural programming
 Involves dividing a large program into a set of sub-
procedures or subprograms that perform specific tasks.
 Module consists of single or multiple procedures.
 Most of the data is shared as global that can be accessed
from anywhere within the program.
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 3
Procedural programming
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 4
Difficulties in Procedural App
 Focus is on procedures
 All data is shared: no protection
 More difficult to modify
 Hard to manage complexity
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 5
Object Oriented programming
 an approach that provides a way of modularizing
programs by creating partitioned memory area for
both data and functions that can be used as template
for creating copies of such modules on demand.
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 6
Advantages of OOP
 Real-world programming
 Reusability of code
 Modularity of code
 Resilience to change
 Information hiding
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 7
Procedural vs. Object-Oriented
 Procedural
Withdraw, deposit, transfer
 Object Oriented
Customer, money, account
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 8
Procedural vs. Object-Oriented
S. No Procedural Programming Object-Oriented Programming
1 Emphasis on Procedures Emphasis on Data
2 Data is not hidden Data is hidden
3 Data and methods are separate Data and methods are combined using
objects
4 Data can be accessed by external
functions
Data cannot be accessed by external
functions
5 Top-down Approach in program
design
Bottom-up Approach in program
design
6 Eg. C, PASCAL Eg. C++, JAVA, Smalltalk
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 9
OOP Concepts
 Objects
 Classes
 Data Abstraction
 Data Encapsulation
 Inheritance
 Polymorphism
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 10
JAVA
 James Gosling and Sun Microsystems
 Oak
 Java, May 20, 1995, Sun World
 HotJava
 The first Java-enabled Web browser
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 11
JAVA
 James Gosling, Mike Sheridan, and Patrick
Naughton initiated the Java language project in
June 1991. The small team of sun engineers
called Green Team.
 Originally designed for small, embedded
systems in electronic appliances like set-top
boxes.
 Firstly, it was called “Greentalk” by James
Gosling, and file extension was .gt.
 After that, it was called Oak and was
developed as a part of the Green project.
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 12
JAVA
 According to James Gosling, “Java was one of the
top choices along with Silk“.
 Java is an island of Indonesia where first coffee was
produced (called java coffee).
 Notice that Java is just a name, not an acronym.
 In 1995, Time magazine called Java one of the Ten
Best Products of 1995.
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 13
Java Milestones
Year Development
1990 Sun decided to developed special software that could be used
for electronic devices. A project called Green Project created
and headed by James Gosling.
1991 Explored possibility of using C++, with some updates
announced a new language named “Oak”
1992 The team demonstrated the application of their new language
to control a list of home appliances using a hand held device.
1993 The World Wide Web appeared on the Internet and
transformed the text-based interface to a graphical rich
environment. The team developed Web applets (time
programs) that could run on all types of computers connected
to the Internet.
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam
Java Milestones
Year Development
1994 The team developed a new Web browsed called “Hot Java” to
locate and run Applets. HotJava gained instance success.
1995 Oak was renamed to Java, as it did not survive “legal”
registration. Many companies such as Netscape and
Microsoft announced their support for Java
1996 Java established itself it self as both 1. “the language for
Internet programming” 2. a general purpose OO language.
1997- A class libraries, Community effort and standardization,
Enterprise Java, Clustering, etc..
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam
Sun white paper defines Java as:
 Simple and Powerful
 Safe
 Object Oriented
 Robust
 Architecture Neutral and Portable
 Interpreted and High Performance
 Threaded
 Dynamic
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 16
Java Attributes
 Familiar, Simple, Small
 Compiled and Interpreted
 Platform-Independent and Portable
 Object-Oriented
 Robust and Secure
 Distributed
 Multithreaded and Interactive
 High Performance
 Dynamic and Extensible
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 17
Overlap of C, C++, and Java
C
C++
Java
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 18
Java better than C++ ?
 No Typedefs, Defines, or Preprocessor
 No Global Variables
 No Pointers
 No Unsafe Structures
 No Multiple Inheritance
 No Operator Overloading
 No Automatic Coercions
 No Fragile Data Types
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 19
Object Oriented Languages -A Comparison
Feature C++ Objective C Ada Java
Encapsulation Yes Yes Yes Yes
Inheritance Yes Yes No Yes
Multiple Inherit. Yes Yes No No
Polymorphism Yes Yes Yes Yes
Binding (Early or Late) Both Both Early Late
Concurrency Poor Poor Difficult Yes
Garbage Collection No Yes No Yes
Genericity Yes No Yes Limited
Class Libraries Yes Yes Limited Yes
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam
JDK Editions
 Java Standard Edition (J2SE)
 J2SE can be used to develop client-side standalone
applications or applets.
 Java Enterprise Edition (J2EE)
 J2EE can be used to develop server-side
applications such as Java servlets and Java
ServerPages.
 Java Micro Edition (J2ME).
 J2ME can be used to develop applications for
mobile devices such as cell phones.
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 21
JDK
 Versions
 JDK 1 (1995), JDK 1.2 (1998), JDK 1.3 (2000)
 JDK 1.4 (2002), JDK 1.5 (2004), JDK 6 (2006)
 JDK 7 (2011), JDK 12 (2019), JDK 13 (2019)
 Tools
 appletviewer (for viewing Applets)
 javac (Java Compiler)
 java (Java Interpreter)
 jdb (Java Debugger)
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 22
Java as Portable
 Unlike other language compilers, Java complier
generates code (byte codes) for Universal Machine.
 Java Virtual Machine (JVM): Interprets bytecodes at
runtime
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 23
Java as Portable
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 24
Total Platform Independence
JAVA COMPILER
JAVA BYTE CODE
JAVA INTERPRETER
Windows 95 Macintosh Solaris Windows NT
(translator)
(same for all platforms)
(one for each different system)
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 25
Architecture Neutral & Portable
 Java Compiler - Java source code (file with
extension .java) to bytecode (file with extension
.class)
 Bytecode - an intermediate form, closer to
machine representation
 A interpreter (virtual machine) on any target
platform interprets the bytecode.
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 26
JAVA Program Structure
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 27
First JAVA Application
/* Hello World, first application, only output. */
import java.io.*;
public class Hello
{
public static void main (String [] args)
{
System.out.println(“Java Hello Worldn”);
} //end main
}//end class
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 28
How to get it running
 To compile:
 javac Hello.java
 To run:
 java Hello
 Note:
 Java is CASE SENSITIVE!!
 Whitespace is ignored by compiler
 File name has to be the same as class name in file.
 Need to import necessary class definitions
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 29
Java Path Setting
 On Error:
 Select Computer from the Start menu
 Choose System Properties from the context menu
 Click Advanced system settings > Advanced tab
 Click on Environment Variables, under System Variables, find PATH, and click on it.
 In the Edit windows, modify PATH by adding the location of the class to the value for
PATH.
 Reopen Command prompt window, and run your java code.
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 30
JAVA Keywords
abstract continue for new switch
assert default goto package synchronized
boolean do if private this
break double implements protected throw
byte else import public throws
case enum instanceof return transient
catch extends int short try
char final interface static void
class finally long strictfp volatile
const float native super while
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 31
Primitive Data Types
• Value of primitive type is not considered an object
• java.lang provides wrapper classes for each of
the primitive types
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 1-32
Java Data Types
 Sizes fully specified by Java standard.
 Java is a very strongly typed language
 Integer types
 int (4 bytes signed)
 short (2 bytes signed)
 long (8 bytes signed) use suffix L (eg 1000000000L)
 byte (1 byte signed)
 Floating-point types
 float (4 bytes) use suffix F (eg 1.28F)
 double( 8 bytes)
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 33
Operators
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 1-34
Flow Controls
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 35
End…
Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 36

More Related Content

PPSX
Introduction to Java
Hitesh-Java
 
PPT
Java basic
Arati Gadgil
 
PPTX
Java Spring Framework
Mehul Jariwala
 
PPTX
Spring Framework
tola99
 
PDF
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Edureka!
 
PPTX
Introduction to JAVA
ParminderKundu
 
PPTX
Angular
sridhiya
 
PDF
Page Object Model and Implementation in Selenium
Zoe Gilbert
 
Introduction to Java
Hitesh-Java
 
Java basic
Arati Gadgil
 
Java Spring Framework
Mehul Jariwala
 
Spring Framework
tola99
 
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Edureka!
 
Introduction to JAVA
ParminderKundu
 
Angular
sridhiya
 
Page Object Model and Implementation in Selenium
Zoe Gilbert
 

What's hot (20)

PDF
Spring Boot
Jaran Flaath
 
PPTX
Introducing Swagger
Tony Tam
 
PDF
Spring Security
Knoldus Inc.
 
PPT
Adapter pattern
Shakil Ahmed
 
PPT
Graphql presentation
Vibhor Grover
 
PPSX
Selenium WebDriver
Rajathi-QA
 
PPTX
Selenium
mdfkhan625
 
PDF
Introduction to flutter
Wan Muzaffar Wan Hashim
 
PDF
Introduction to Java 11
Knoldus Inc.
 
PDF
React Native
vishal kumar
 
PDF
Java Collections | Collections Framework in Java | Java Tutorial For Beginner...
Edureka!
 
PPTX
Web Application Performance
CodeFireTech
 
PDF
Introduction to Java Programming
Ravi Kant Sahu
 
PDF
SELENIUM PPT.pdf
RebelSnowball
 
PPTX
Load Testing with k6 framework
Svetlin Nakov
 
PDF
MEAN Stack
Krishnaprasad k
 
PPTX
Angular 14.pptx
MohaNedGhawar
 
PDF
LinkedList vs ArrayList in Java | Edureka
Edureka!
 
PDF
Java SE 8 best practices
Stephen Colebourne
 
PPTX
Mongoose and MongoDB 101
Will Button
 
Spring Boot
Jaran Flaath
 
Introducing Swagger
Tony Tam
 
Spring Security
Knoldus Inc.
 
Adapter pattern
Shakil Ahmed
 
Graphql presentation
Vibhor Grover
 
Selenium WebDriver
Rajathi-QA
 
Selenium
mdfkhan625
 
Introduction to flutter
Wan Muzaffar Wan Hashim
 
Introduction to Java 11
Knoldus Inc.
 
React Native
vishal kumar
 
Java Collections | Collections Framework in Java | Java Tutorial For Beginner...
Edureka!
 
Web Application Performance
CodeFireTech
 
Introduction to Java Programming
Ravi Kant Sahu
 
SELENIUM PPT.pdf
RebelSnowball
 
Load Testing with k6 framework
Svetlin Nakov
 
MEAN Stack
Krishnaprasad k
 
Angular 14.pptx
MohaNedGhawar
 
LinkedList vs ArrayList in Java | Edureka
Edureka!
 
Java SE 8 best practices
Stephen Colebourne
 
Mongoose and MongoDB 101
Will Button
 
Ad

Similar to Java - OOPS and Java Basics (20)

PDF
A CASE STUDY JAVA IS SECURE PROGRAMMING LANGUAGE
Nathan Mathis
 
PPT
1.INTRODUCTION TO JAVA_2022 MB.ppt .
happycocoman
 
PPTX
1_Introduction to Java.pptx java programming
amitraj53904
 
PPT
Java ppt-class_Introduction_class_Objects.ppt
VGaneshKarthikeyan
 
DOCX
Java Tutorial to Learn Java Programming
business Corporate
 
PPSX
Java Semimar Slide (Cetpa)
Pratima Parida
 
PPSX
Java Semimar Slide (Cetpa)
Pratima Parida
 
PDF
Overview of Java
Spotle.ai
 
PPT
Java ppt-class_basic data types methods definitions
ganeshkarthy
 
PPTX
Presentation5
Natasha Bains
 
PPT
Core Java Slides
Vinit Vyas
 
PPTX
Session 02 - Elements of Java Language
PawanMM
 
PDF
Java Notes .pdf
gokulprasanna4
 
PPT
10 interesting things about java
kanchanmahajan23
 
PPT
Java presentation
Karan Sareen
 
PPSX
Elements of Java Language
Hitesh-Java
 
PPT
Unit-INP.ppt
Osmania University
 
A CASE STUDY JAVA IS SECURE PROGRAMMING LANGUAGE
Nathan Mathis
 
1.INTRODUCTION TO JAVA_2022 MB.ppt .
happycocoman
 
1_Introduction to Java.pptx java programming
amitraj53904
 
Java ppt-class_Introduction_class_Objects.ppt
VGaneshKarthikeyan
 
Java Tutorial to Learn Java Programming
business Corporate
 
Java Semimar Slide (Cetpa)
Pratima Parida
 
Java Semimar Slide (Cetpa)
Pratima Parida
 
Overview of Java
Spotle.ai
 
Java ppt-class_basic data types methods definitions
ganeshkarthy
 
Presentation5
Natasha Bains
 
Core Java Slides
Vinit Vyas
 
Session 02 - Elements of Java Language
PawanMM
 
Java Notes .pdf
gokulprasanna4
 
10 interesting things about java
kanchanmahajan23
 
Java presentation
Karan Sareen
 
Elements of Java Language
Hitesh-Java
 
Unit-INP.ppt
Osmania University
 
Ad

More from Victer Paul (13)

PDF
OOAD - UML - Sequence and Communication Diagrams - Lab
Victer Paul
 
PDF
OOAD - UML - Class and Object Diagrams - Lab
Victer Paul
 
PDF
OOAD - Systems and Object Orientation Concepts
Victer Paul
 
PDF
Java - Strings Concepts
Victer Paul
 
PDF
Java - Packages Concepts
Victer Paul
 
PDF
Java - Exception Handling Concepts
Victer Paul
 
PDF
Java - Class Structure
Victer Paul
 
PDF
Java - Object Oriented Programming Concepts
Victer Paul
 
PDF
Java - Basic Concepts
Victer Paul
 
PDF
Java - File Input Output Concepts
Victer Paul
 
PDF
Java - Inheritance Concepts
Victer Paul
 
PDF
Java - Arrays Concepts
Victer Paul
 
PDF
Java applet programming concepts
Victer Paul
 
OOAD - UML - Sequence and Communication Diagrams - Lab
Victer Paul
 
OOAD - UML - Class and Object Diagrams - Lab
Victer Paul
 
OOAD - Systems and Object Orientation Concepts
Victer Paul
 
Java - Strings Concepts
Victer Paul
 
Java - Packages Concepts
Victer Paul
 
Java - Exception Handling Concepts
Victer Paul
 
Java - Class Structure
Victer Paul
 
Java - Object Oriented Programming Concepts
Victer Paul
 
Java - Basic Concepts
Victer Paul
 
Java - File Input Output Concepts
Victer Paul
 
Java - Inheritance Concepts
Victer Paul
 
Java - Arrays Concepts
Victer Paul
 
Java applet programming concepts
Victer Paul
 

Recently uploaded (20)

PDF
Architecture of the Future (09152021)
EdwardMeyman
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PPTX
IoT Sensor Integration 2025 Powering Smart Tech and Industrial Automation.pptx
Rejig Digital
 
PDF
Software Development Methodologies in 2025
KodekX
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PDF
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
PDF
REPORT: Heating appliances market in Poland 2024
SPIUG
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PDF
Software Development Company | KodekX
KodekX
 
PDF
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira Júnior
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
Architecture of the Future (09152021)
EdwardMeyman
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
IoT Sensor Integration 2025 Powering Smart Tech and Industrial Automation.pptx
Rejig Digital
 
Software Development Methodologies in 2025
KodekX
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
REPORT: Heating appliances market in Poland 2024
SPIUG
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
Software Development Company | KodekX
KodekX
 
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira Júnior
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 

Java - OOPS and Java Basics

  • 1. OOPS and JAVA Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 1
  • 2. Programming Language  A programming language is a computer language programmers use to develop applications, scripts, or other set of instructions for a computer to perform specific tasks.  The commonly used programming methodologies are:  Procedural programming  Object-oriented programming (OOP) Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 2
  • 3. Procedural programming  Involves dividing a large program into a set of sub- procedures or subprograms that perform specific tasks.  Module consists of single or multiple procedures.  Most of the data is shared as global that can be accessed from anywhere within the program. Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 3
  • 4. Procedural programming Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 4
  • 5. Difficulties in Procedural App  Focus is on procedures  All data is shared: no protection  More difficult to modify  Hard to manage complexity Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 5
  • 6. Object Oriented programming  an approach that provides a way of modularizing programs by creating partitioned memory area for both data and functions that can be used as template for creating copies of such modules on demand. Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 6
  • 7. Advantages of OOP  Real-world programming  Reusability of code  Modularity of code  Resilience to change  Information hiding Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 7
  • 8. Procedural vs. Object-Oriented  Procedural Withdraw, deposit, transfer  Object Oriented Customer, money, account Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 8
  • 9. Procedural vs. Object-Oriented S. No Procedural Programming Object-Oriented Programming 1 Emphasis on Procedures Emphasis on Data 2 Data is not hidden Data is hidden 3 Data and methods are separate Data and methods are combined using objects 4 Data can be accessed by external functions Data cannot be accessed by external functions 5 Top-down Approach in program design Bottom-up Approach in program design 6 Eg. C, PASCAL Eg. C++, JAVA, Smalltalk Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 9
  • 10. OOP Concepts  Objects  Classes  Data Abstraction  Data Encapsulation  Inheritance  Polymorphism Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 10
  • 11. JAVA  James Gosling and Sun Microsystems  Oak  Java, May 20, 1995, Sun World  HotJava  The first Java-enabled Web browser Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 11
  • 12. JAVA  James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in June 1991. The small team of sun engineers called Green Team.  Originally designed for small, embedded systems in electronic appliances like set-top boxes.  Firstly, it was called “Greentalk” by James Gosling, and file extension was .gt.  After that, it was called Oak and was developed as a part of the Green project. Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 12
  • 13. JAVA  According to James Gosling, “Java was one of the top choices along with Silk“.  Java is an island of Indonesia where first coffee was produced (called java coffee).  Notice that Java is just a name, not an acronym.  In 1995, Time magazine called Java one of the Ten Best Products of 1995. Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 13
  • 14. Java Milestones Year Development 1990 Sun decided to developed special software that could be used for electronic devices. A project called Green Project created and headed by James Gosling. 1991 Explored possibility of using C++, with some updates announced a new language named “Oak” 1992 The team demonstrated the application of their new language to control a list of home appliances using a hand held device. 1993 The World Wide Web appeared on the Internet and transformed the text-based interface to a graphical rich environment. The team developed Web applets (time programs) that could run on all types of computers connected to the Internet. Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam
  • 15. Java Milestones Year Development 1994 The team developed a new Web browsed called “Hot Java” to locate and run Applets. HotJava gained instance success. 1995 Oak was renamed to Java, as it did not survive “legal” registration. Many companies such as Netscape and Microsoft announced their support for Java 1996 Java established itself it self as both 1. “the language for Internet programming” 2. a general purpose OO language. 1997- A class libraries, Community effort and standardization, Enterprise Java, Clustering, etc.. Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam
  • 16. Sun white paper defines Java as:  Simple and Powerful  Safe  Object Oriented  Robust  Architecture Neutral and Portable  Interpreted and High Performance  Threaded  Dynamic Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 16
  • 17. Java Attributes  Familiar, Simple, Small  Compiled and Interpreted  Platform-Independent and Portable  Object-Oriented  Robust and Secure  Distributed  Multithreaded and Interactive  High Performance  Dynamic and Extensible Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 17
  • 18. Overlap of C, C++, and Java C C++ Java Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 18
  • 19. Java better than C++ ?  No Typedefs, Defines, or Preprocessor  No Global Variables  No Pointers  No Unsafe Structures  No Multiple Inheritance  No Operator Overloading  No Automatic Coercions  No Fragile Data Types Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 19
  • 20. Object Oriented Languages -A Comparison Feature C++ Objective C Ada Java Encapsulation Yes Yes Yes Yes Inheritance Yes Yes No Yes Multiple Inherit. Yes Yes No No Polymorphism Yes Yes Yes Yes Binding (Early or Late) Both Both Early Late Concurrency Poor Poor Difficult Yes Garbage Collection No Yes No Yes Genericity Yes No Yes Limited Class Libraries Yes Yes Limited Yes Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam
  • 21. JDK Editions  Java Standard Edition (J2SE)  J2SE can be used to develop client-side standalone applications or applets.  Java Enterprise Edition (J2EE)  J2EE can be used to develop server-side applications such as Java servlets and Java ServerPages.  Java Micro Edition (J2ME).  J2ME can be used to develop applications for mobile devices such as cell phones. Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 21
  • 22. JDK  Versions  JDK 1 (1995), JDK 1.2 (1998), JDK 1.3 (2000)  JDK 1.4 (2002), JDK 1.5 (2004), JDK 6 (2006)  JDK 7 (2011), JDK 12 (2019), JDK 13 (2019)  Tools  appletviewer (for viewing Applets)  javac (Java Compiler)  java (Java Interpreter)  jdb (Java Debugger) Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 22
  • 23. Java as Portable  Unlike other language compilers, Java complier generates code (byte codes) for Universal Machine.  Java Virtual Machine (JVM): Interprets bytecodes at runtime Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 23
  • 24. Java as Portable Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 24
  • 25. Total Platform Independence JAVA COMPILER JAVA BYTE CODE JAVA INTERPRETER Windows 95 Macintosh Solaris Windows NT (translator) (same for all platforms) (one for each different system) Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 25
  • 26. Architecture Neutral & Portable  Java Compiler - Java source code (file with extension .java) to bytecode (file with extension .class)  Bytecode - an intermediate form, closer to machine representation  A interpreter (virtual machine) on any target platform interprets the bytecode. Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 26
  • 27. JAVA Program Structure Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 27
  • 28. First JAVA Application /* Hello World, first application, only output. */ import java.io.*; public class Hello { public static void main (String [] args) { System.out.println(“Java Hello Worldn”); } //end main }//end class Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 28
  • 29. How to get it running  To compile:  javac Hello.java  To run:  java Hello  Note:  Java is CASE SENSITIVE!!  Whitespace is ignored by compiler  File name has to be the same as class name in file.  Need to import necessary class definitions Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 29
  • 30. Java Path Setting  On Error:  Select Computer from the Start menu  Choose System Properties from the context menu  Click Advanced system settings > Advanced tab  Click on Environment Variables, under System Variables, find PATH, and click on it.  In the Edit windows, modify PATH by adding the location of the class to the value for PATH.  Reopen Command prompt window, and run your java code. Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 30
  • 31. JAVA Keywords abstract continue for new switch assert default goto package synchronized boolean do if private this break double implements protected throw byte else import public throws case enum instanceof return transient catch extends int short try char final interface static void class finally long strictfp volatile const float native super while Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 31
  • 32. Primitive Data Types • Value of primitive type is not considered an object • java.lang provides wrapper classes for each of the primitive types Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 1-32
  • 33. Java Data Types  Sizes fully specified by Java standard.  Java is a very strongly typed language  Integer types  int (4 bytes signed)  short (2 bytes signed)  long (8 bytes signed) use suffix L (eg 1000000000L)  byte (1 byte signed)  Floating-point types  float (4 bytes) use suffix F (eg 1.28F)  double( 8 bytes) Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 33
  • 34. Operators Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 1-34
  • 35. Flow Controls Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 35
  • 36. End… Dr. P. Victer Paul, Indian Institute of Information Technology Kottayam 36