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

What's hot (20)

PPTX
MERN PPT
NeerajGupta96647
 
PPT
Java-java virtual machine
Surbhi Panhalkar
 
PDF
Java Training | Java Tutorial for Beginners | Java Programming | Java Certifi...
Edureka!
 
PPTX
Presentation on Core java
mahir jain
 
PPTX
Java Server Pages(jsp)
Manisha Keim
 
PPTX
Training on Core java | PPT Presentation | Shravan Sanidhya
Shravan Sanidhya
 
PPTX
Introduction to Spring Boot
Purbarun Chakrabarti
 
PPTX
Introduction to Basic Java Versions and their features
Akash Badone
 
PPTX
Introduction to java
Java Lover
 
PPT
Spring Boot in Action
Alex Movila
 
PPTX
ppt of web development for diploma student
Abhishekchauhan863165
 
PPT
JQuery introduction
NexThoughts Technologies
 
PDF
Java Classes | Java Tutorial for Beginners | Java Classes and Objects | Java ...
Edureka!
 
PDF
Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...
Edureka!
 
PPTX
Java Programming
Elizabeth alexander
 
PPT
Java tutorial PPT
Intelligo Technologies
 
PPSX
Introduction to Java
Hitesh-Java
 
PPTX
Java project-presentation
APSMIND TECHNOLOGY PVT LTD.
 
PPT
Fundamentals of JAVA
KUNAL GADHIA
 
Java-java virtual machine
Surbhi Panhalkar
 
Java Training | Java Tutorial for Beginners | Java Programming | Java Certifi...
Edureka!
 
Presentation on Core java
mahir jain
 
Java Server Pages(jsp)
Manisha Keim
 
Training on Core java | PPT Presentation | Shravan Sanidhya
Shravan Sanidhya
 
Introduction to Spring Boot
Purbarun Chakrabarti
 
Introduction to Basic Java Versions and their features
Akash Badone
 
Introduction to java
Java Lover
 
Spring Boot in Action
Alex Movila
 
ppt of web development for diploma student
Abhishekchauhan863165
 
JQuery introduction
NexThoughts Technologies
 
Java Classes | Java Tutorial for Beginners | Java Classes and Objects | Java ...
Edureka!
 
Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...
Edureka!
 
Java Programming
Elizabeth alexander
 
Java tutorial PPT
Intelligo Technologies
 
Introduction to Java
Hitesh-Java
 
Java project-presentation
APSMIND TECHNOLOGY PVT LTD.
 
Fundamentals of JAVA
KUNAL GADHIA
 

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
 
PPT
Unit-INP.ppt
Osmania University
 
PPTX
Java 2 computer science.pptx
MUHAMMED MASHAHIL PUKKUNNUMMAL
 
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
 
Unit-INP.ppt
Osmania University
 
Java 2 computer science.pptx
MUHAMMED MASHAHIL PUKKUNNUMMAL
 
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
 
Ad

Recently uploaded (20)

PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 

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