SlideShare a Scribd company logo
1 of 42
PROGRAMMING IN JAVA
Introduction to JAVA
Lecture 1: Genesis and overview of Java
By
Ravi Kant Sahu
Asst. Professor, LPU
Contents
• What is JAVA?
• What is OOP?
• Why Java?
• Characteristics of JAVA
• Overview of Java.
• The difference between Java and C++?
• A Simple JAVA Program
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
What is JAVA?
• Developed by Sun Microsystems (James
Gosling)
• A general-purpose Object-Oriented language
• Based on C/C++
• Designed for easy Web/Internet applications
• Widespread acceptance
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
What is Object Oriented Programming?
Object-oriented programming is a method of
implementation in which programs are organized as
cooperative collections of objects, each of which
represents an instance of some class, and whose classes
are all members of one or more hierarchy of classes
united via inheritance relationships.
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Principles of OOP
• All object-oriented programming languages
provide mechanisms that help you implement the
object-oriented model.
• They are:
• Encapsulation
• Inheritance
• Polymorphism
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Data Encapsulation
Encapsulation is the mechanism that binds together code
and the data it manipulates, and keeps both safe from
outside interference and misuse.
class Account {
int x=10;
float withdraw();
void deposit(float amount);
float balance;
}
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Advantages of Encapsulation
• Protection
• Consistency
• Allows change
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Inheritance
• Inheritance is the process by which one object acquires the
properties of another object.
• A class that is derived from another class is called a subclass
(also a derived class, extended class, or child class).
• The class from which the subclass is derived is called a super
class (also a base class or a parent class).
• A class which is a subtype of a more general class is said to
be inherited from it.
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Inheritance cont’d
• The sub-class inherits the base class’ data members and
member functions.
• A sub-class has all data members of its base-class plus its
own.
• A sub-class has all member functions of its base class (with
changes) plus its own.
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Polymorphism
• Polymorphism refers to a programming language's ability
to process objects differently depending on their data type or
class.
• Generally, the ability to appear in many forms.
• More specifically, it is the ability to redefine methods for
derived classes.
• For example, given a base class shape, polymorphism
enables the programmer to define different area methods for
any number of derived classes, such as circles, rectangles and
triangles. No matter what shape an object is, applying the
area method to it will return the correct results.
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Why Java?
Java is the Internet programming language.
Java enables users to develop and deploy applications
on the Internet for servers, desktop computers, and
small hand-held devices.
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Java, Web, and Beyond
• Java Applets
• Java Web Applications
• Java can also be used to develop applications for
hand-held devices such as Palm and cell phones
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Characteristics of Java
•Java Is Simple
•Java Is Object-Oriented
•Java Is Distributed
•Java Is Interpreted
•Java Is Robust
•Java Is Secure
•Java Is Architecture-Neutral
•Java Is Portable
•Java's Performance
•Java Is Multithreaded
•Java Is Dynamic
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Characteristics of Java
•Java Is Simple
•Java Is Object-Oriented
•Java Is Distributed
•Java Is Interpreted
•Java Is Robust
•Java Is Secure
•Java Is Architecture-Neutral
•Java Is Portable
•Java's Performance
•Java Is Multithreaded
•Java Is Dynamic
Java is partially modeled on C++, but
greatly simplified and improved. Some
people refer to Java as "C++--" because it
is like C++ but with more functionality and
fewer negative aspects.
Characteristics of Java
•Java Is Simple
•Java Is Object-Oriented
•Java Is Distributed
•Java Is Interpreted
•Java Is Robust
•Java Is Secure
•Java Is Architecture-Neutral
•Java Is Portable
•Java's Performance
•Java Is Multithreaded
•Java Is Dynamic
Java is inherently object-oriented.
Although many object-oriented
languages began strictly as procedural
languages, Java was designed from
the start to be object-oriented. Object-
oriented programming (OOP) is a
popular programming approach that is
replacing traditional procedural
programming techniques.
One of the central issues in software
development is how to reuse code.
Object-oriented programming provides
great flexibility, modularity, clarity, and
reusability through encapsulation,
inheritance, and polymorphism.
Characteristics of Java
•Java Is Simple
•Java Is Object-Oriented
•Java Is Distributed
•Java Is Interpreted
•Java Is Robust
•Java Is Secure
•Java Is Architecture-Neutral
•Java Is Portable
•Java's Performance
•Java Is Multithreaded
•Java Is Dynamic
Distributed computing involves several
computers working together on a
network. Java is designed to make
distributed computing easy. Since
networking capability is inherently
integrated into Java, writing network
programs is like sending and receiving
data to and from a file.
Characteristics of Java
•Java Is Simple
•Java Is Object-Oriented
•Java Is Distributed
•Java Is Interpreted
•Java Is Robust
•Java Is Secure
•Java Is Architecture-Neutral
•Java Is Portable
•Java's Performance
•Java Is Multithreaded
•Java Is Dynamic
You need an interpreter to run Java
programs. The programs are compiled
into the Java Virtual Machine code
called bytecode. The bytecode is
machine-independent and can run on
any machine that has a Java
interpreter, which is part of the Java
Virtual Machine (JVM).
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Characteristics of Java
•Java Is Simple
•Java Is Object-Oriented
•Java Is Distributed
•Java Is Interpreted
•Java Is Robust
•Java Is Secure
•Java Is Architecture-Neutral
•Java Is Portable
•Java's Performance
•Java Is Multithreaded
•Java Is Dynamic
Java compilers can detect many
problems that would first show up at
execution time in other languages.
Java has eliminated certain types of
error-prone programming constructs
found in other languages.
Java has a runtime exception-handling
feature to provide programming
support for robustness.
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Characteristics of Java
•Java Is Simple
•Java Is Object-Oriented
•Java Is Distributed
•Java Is Interpreted
•Java Is Robust
•Java Is Secure
•Java Is Architecture-Neutral
•Java Is Portable
•Java's Performance
•Java Is Multithreaded
•Java Is Dynamic
Java implements several security
mechanisms to protect your system
against harm caused by stray
programs.
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Characteristics of Java
•Java Is Simple
•Java Is Object-Oriented
•Java Is Distributed
•Java Is Interpreted
•Java Is Robust
•Java Is Secure
•Java Is Architecture-Neutral
•Java Is Portable
•Java's Performance
•Java Is Multithreaded
•Java Is Dynamic
Write once, run anywhere
With a Java Virtual Machine (JVM),
you can write one program that will
run on any platform.
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Characteristics of Java
•Java Is Simple
•Java Is Object-Oriented
•Java Is Distributed
•Java Is Interpreted
•Java Is Robust
•Java Is Secure
•Java Is Architecture-Neutral
•Java Is Portable
•Java's Performance
•Java Is Multithreaded
•Java Is Dynamic
Because Java is architecture neutral,
Java programs are portable. They can
be run on any platform without being
recompiled.
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Characteristics of Java
•Java Is Simple
•Java Is Object-Oriented
•Java Is Distributed
•Java Is Interpreted
•Java Is Robust
•Java Is Secure
•Java Is Architecture-Neutral
•Java Is Portable
•Java's Performance
•Java Is Multithreaded
•Java Is Dynamic
Java’s performance Because Java is
architecture neutral, Java programs
are portable. They can be run on any
platform without being recompiled.
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Characteristics of Java
•Java Is Simple
•Java Is Object-Oriented
•Java Is Distributed
•Java Is Interpreted
•Java Is Robust
•Java Is Secure
•Java Is Architecture-Neutral
•Java Is Portable
•Java's Performance
•Java Is Multithreaded
•Java Is Dynamic
Multithread programming is smoothly
integrated in Java, whereas in other
languages you have to call procedures
specific to the operating system to enable
multithreading.
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Characteristics of Java
•Java Is Simple
•Java Is Object-Oriented
•Java Is Distributed
•Java Is Interpreted
•Java Is Robust
•Java Is Secure
•Java Is Architecture-Neutral
•Java Is Portable
•Java's Performance
•Java Is Multithreaded
•Java Is Dynamic
Java was designed to adapt to an evolving
environment. New code can be loaded on the
fly without recompilation. There is no need for
developers to create, and for users to install,
major new software versions. New features can
be incorporated transparently as needed.
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Java Disadvantages
• Slower than compiled language such as C
• an experiment in 1999 showed that Java was 3 or 4
times slower than C or C++
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Origin of Java
• Generation
• James Gosling & Patrick Naughton at 1990
• Goal : to develop distributed system which is
applicable to electronic products(platform
independent)
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
James Gosling
• James Gosling is generally
credited as the inventor of the Java
programming language
• He was the first designer of Java
and implemented its original
compiler and virtual machine
• He is also known as the Father
of Java.
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Brief History of Java
• In 1990, Sun Microsystems began an internal project known as
the Green Project to work on a new technology.
• In 1992, the Green Project was spun off and its interest directed
toward building highly interactive devices for the cable TV industry.
This failed to materialize.
• In 1994, the focus of the original team was re-targeted, this time
to the use of Internet technology. A small web browser called
HotJava was written.
• Oak was renamed to Java after learning that Oak had already
been trademarked.
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
• In 1995, Java was first publicly released.
• In 1996, Java Development Kit (JDK) 1.0 was released.
• In 2002, JDK 1.4 (codename Merlin) was released, the most
widely used version.
• In 2004, JDK 5.0 (codename Tiger) was released.
•The latest version of java is jdk 8.0.
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
JDK Versions
•JDK 1.02 (1995) … 250 classes
•JDK 1.1 (1996) … 500 classes
•JDK 1.2 (1998) … 2300 classes
•JDK 1.3 (2000) … 2300 classes
•JDK 1.4 (2002) … 2300 classes
•JDK 1.5 (2004) … 3500 classes
•JDK 1.6 (2006) … 3500 classes
•JDK 1.7 (2011) … 3500 classes
•JDK 1.8 (2014) … 3500 classes
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Java Platform Editions
• A Java Platform is the set of APIs, class libraries, and
other programs used in developing Java programs for
specific applications.
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
There are 3 Java Platform Editions
1. Java 2 Platform, Standard Edition (J2SE)
• Core Java Platform targeting applications running on
workstations
2. Java 2 Platform, Enterprise Edition (J2EE)
• Component-based approach to developing distributed,
multi-tier enterprise applications
3. Java 2 Platform, Micro Edition (J2ME)
• Targeted at small, stand-alone or connectable
consumer and embedded devices
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Java Development Kit (JDK)
Java Development Kit (JDK)
• Is a set of Java tools for developing Java programs
• Consists of Java API, Java Compiler, and JVM
Java Application Programming Interface (API)
• Is prewritten code, organized into packages of similar topics
Java Virtual Machine
Java API
MyProgram.java
Hardware - Based Platform
JDK
JRE
Java Virtual
Machine (JVM) is
an execution engine
that runs compiled
Java byte code.
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Structure Overview of Java
Hardware Platform
OS Platform
Java Virtual Machine
Java APIs
Sparc, Intel, Mac,
HP ...
Solaris, Windows, Mac, Linux ..
OS
application
Language Primitives
Auxiliary Window Tookit
JDBCRMI
Servlet API JavaBeans
Etc.
JDBC Drivers
Web Server
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Java life cycle
•Java programs normally undergo four phases
• Edit
•Programmer writes program (and stores program on
disk)
• Compile
•Compiler creates byte-codes from program (.class)
• Load
•Class loader stores byte-codes in memory
• Execute
•Interpreter: translates byte-codes into machine language
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Java life cycle
• Source code (.java)
• Compiled into Byte codes (.class) , as (.exe) in c++
– The Java Application Programming Interface
(API)
• a large collection of ready-made software components.
It is grouped into libraries of related classes and
interfaces; these libraries are known as packages.
– Java Virtual Machine (JVM)
– Machine code
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Java life, cont..
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
JVM an Portability
• Through the Java VM, the same application is capable of
running on multiple platforms.
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
A Simple Java Program
//This program prints Welcome to Java!
public class Welcome
{
public static void main(String[] args)
{
System.out.println("Welcome to Java!");
}
}
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Compiling Java Source Code
Java was designed to run object programs on any platform.
With Java, you write the program once, and compile the source
program into a special type of object code, known as bytecode.
The byte-code can then run on any computer with a Java Virtual
Machine, as shown below.
Java Virtual Machine is a software
that interprets Java byte-code.
Java Bytecode
Java Virtual
Machine
Any
Computer
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)

More Related Content

What's hot

Overview of Java
Overview of JavaOverview of Java
Overview of Javajosemachoco
 
Introduction to java (revised)
Introduction to java (revised)Introduction to java (revised)
Introduction to java (revised)Sujit Majety
 
7장 Oracle As Datasource
7장 Oracle As Datasource7장 Oracle As Datasource
7장 Oracle As Datasource김 한도
 
Java technologies explained to non-technical audience
Java technologies explained to non-technical audienceJava technologies explained to non-technical audience
Java technologies explained to non-technical audienceSteinn 'Stan' Jónsson
 
Java classes in karve nagar pune
Java classes in karve nagar puneJava classes in karve nagar pune
Java classes in karve nagar puneletsleadsand
 
Top 10 Java Interview Questions and Answers 2014
Top 10 Java Interview Questions and Answers 2014 Top 10 Java Interview Questions and Answers 2014
Top 10 Java Interview Questions and Answers 2014 iimjobs and hirist
 
Java Introduction
Java IntroductionJava Introduction
Java Introductionjaveed_mhd
 
Introduction to java
Introduction to java Introduction to java
Introduction to java sanjay joshi
 
159747608 a-training-report-on
159747608 a-training-report-on159747608 a-training-report-on
159747608 a-training-report-onhomeworkping7
 
PROGRAMMING COURSE DATA STRUCTURES
PROGRAMMING COURSE DATA STRUCTURESPROGRAMMING COURSE DATA STRUCTURES
PROGRAMMING COURSE DATA STRUCTURESBALUJAINSTITUTE
 
Introduction to basics of java
Introduction to basics of javaIntroduction to basics of java
Introduction to basics of javavinay arora
 
JAVA Training Syllabus Course
JAVA Training Syllabus CourseJAVA Training Syllabus Course
JAVA Training Syllabus CourseTOPS Technologies
 

What's hot (20)

Overview of Java
Overview of JavaOverview of Java
Overview of Java
 
Introduction to java (revised)
Introduction to java (revised)Introduction to java (revised)
Introduction to java (revised)
 
7장 Oracle As Datasource
7장 Oracle As Datasource7장 Oracle As Datasource
7장 Oracle As Datasource
 
Java technologies explained to non-technical audience
Java technologies explained to non-technical audienceJava technologies explained to non-technical audience
Java technologies explained to non-technical audience
 
Java project
Java projectJava project
Java project
 
Basic of Java
Basic of JavaBasic of Java
Basic of Java
 
Java classes in karve nagar pune
Java classes in karve nagar puneJava classes in karve nagar pune
Java classes in karve nagar pune
 
Presentation5
Presentation5Presentation5
Presentation5
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to Java
 
Top 10 Java Interview Questions and Answers 2014
Top 10 Java Interview Questions and Answers 2014 Top 10 Java Interview Questions and Answers 2014
Top 10 Java Interview Questions and Answers 2014
 
Introduction to Core Java Programming
Introduction to Core Java ProgrammingIntroduction to Core Java Programming
Introduction to Core Java Programming
 
Java Introduction
Java IntroductionJava Introduction
Java Introduction
 
Java basics at dallas technologies
Java basics at dallas technologiesJava basics at dallas technologies
Java basics at dallas technologies
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
 
159747608 a-training-report-on
159747608 a-training-report-on159747608 a-training-report-on
159747608 a-training-report-on
 
PROGRAMMING COURSE DATA STRUCTURES
PROGRAMMING COURSE DATA STRUCTURESPROGRAMMING COURSE DATA STRUCTURES
PROGRAMMING COURSE DATA STRUCTURES
 
Java
JavaJava
Java
 
Introduction to basics of java
Introduction to basics of javaIntroduction to basics of java
Introduction to basics of java
 
Java J2EE Complete Syllabus Checklist
Java J2EE Complete Syllabus ChecklistJava J2EE Complete Syllabus Checklist
Java J2EE Complete Syllabus Checklist
 
JAVA Training Syllabus Course
JAVA Training Syllabus CourseJAVA Training Syllabus Course
JAVA Training Syllabus Course
 

Viewers also liked

Альманах "Метапарадигма", выпуск 4
Альманах "Метапарадигма", выпуск 4Альманах "Метапарадигма", выпуск 4
Альманах "Метапарадигма", выпуск 4Neapolitanskiy
 
Informática básica
Informática básicaInformática básica
Informática básicaaron_2015
 
Michael W Player CV Resume
Michael W Player CV Resume Michael W Player CV Resume
Michael W Player CV Resume Michael Player
 
Designing great customer experiences: NACE presentation
Designing great customer experiences: NACE presentationDesigning great customer experiences: NACE presentation
Designing great customer experiences: NACE presentationStephanie Weaver
 
Introduction to Search Marketing for New Marketers and Students
Introduction to Search Marketing for New Marketers and StudentsIntroduction to Search Marketing for New Marketers and Students
Introduction to Search Marketing for New Marketers and StudentsLauren Perfors
 
Презентация агентства
Презентация агентстваПрезентация агентства
Презентация агентстваДенис Бушуев
 
Sistemas de referencia para ubicar puntos.
Sistemas de referencia para ubicar puntos.Sistemas de referencia para ubicar puntos.
Sistemas de referencia para ubicar puntos.Patricia Ghisleri
 

Viewers also liked (11)

Альманах "Метапарадигма", выпуск 4
Альманах "Метапарадигма", выпуск 4Альманах "Метапарадигма", выпуск 4
Альманах "Метапарадигма", выпуск 4
 
Imagen
ImagenImagen
Imagen
 
Informática básica
Informática básicaInformática básica
Informática básica
 
Michael W Player CV Resume
Michael W Player CV Resume Michael W Player CV Resume
Michael W Player CV Resume
 
Amor maiusculo
Amor maiusculoAmor maiusculo
Amor maiusculo
 
Open Ricostruzione
Open RicostruzioneOpen Ricostruzione
Open Ricostruzione
 
Designing great customer experiences: NACE presentation
Designing great customer experiences: NACE presentationDesigning great customer experiences: NACE presentation
Designing great customer experiences: NACE presentation
 
Introduction to Search Marketing for New Marketers and Students
Introduction to Search Marketing for New Marketers and StudentsIntroduction to Search Marketing for New Marketers and Students
Introduction to Search Marketing for New Marketers and Students
 
Презентация агентства
Презентация агентстваПрезентация агентства
Презентация агентства
 
Sistemas de referencia para ubicar puntos.
Sistemas de referencia para ubicar puntos.Sistemas de referencia para ubicar puntos.
Sistemas de referencia para ubicar puntos.
 
D i L - Kl - ZG
D i L - Kl - ZGD i L - Kl - ZG
D i L - Kl - ZG
 

Similar to L1 basics

U1 JAVA.pptx
U1 JAVA.pptxU1 JAVA.pptx
U1 JAVA.pptxmadan r
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java ProgrammingRavi Kant Sahu
 
Industrial Training Report on Java Technology.
Industrial Training Report on Java Technology.Industrial Training Report on Java Technology.
Industrial Training Report on Java Technology.Ritesh Kumar Bhanu
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to javaManjeet singh
 
Top 100 Java Interview Questions with Detailed Answers
Top 100 Java Interview Questions with Detailed AnswersTop 100 Java Interview Questions with Detailed Answers
Top 100 Java Interview Questions with Detailed AnswersWhizlabs
 
concept of core java
concept of core java concept of core java
concept of core java Mintu_94
 
Java programming language
Java programming languageJava programming language
Java programming languageSubhashKumar329
 
Presentation on Core java
Presentation on Core javaPresentation on Core java
Presentation on Core javamahir jain
 
Complete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept itComplete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept itlokeshpappaka10
 
Java chapter 1 basic introduction Unit-1.pptx
Java chapter  1 basic introduction Unit-1.pptxJava chapter  1 basic introduction Unit-1.pptx
Java chapter 1 basic introduction Unit-1.pptxnoosdysharma
 
Java Introduction - Quipoin.pptx
Java Introduction - Quipoin.pptxJava Introduction - Quipoin.pptx
Java Introduction - Quipoin.pptxquipoin04
 

Similar to L1 basics (20)

2. Basics of Java
2. Basics of Java2. Basics of Java
2. Basics of Java
 
U1 JAVA.pptx
U1 JAVA.pptxU1 JAVA.pptx
U1 JAVA.pptx
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
 
Java assignment help
Java assignment helpJava assignment help
Java assignment help
 
Industrial Training Report on Java Technology.
Industrial Training Report on Java Technology.Industrial Training Report on Java Technology.
Industrial Training Report on Java Technology.
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Top 100 Java Interview Questions with Detailed Answers
Top 100 Java Interview Questions with Detailed AnswersTop 100 Java Interview Questions with Detailed Answers
Top 100 Java Interview Questions with Detailed Answers
 
concept of core java
concept of core java concept of core java
concept of core java
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to Java
 
Java programming language
Java programming languageJava programming language
Java programming language
 
oop unit1.pptx
oop unit1.pptxoop unit1.pptx
oop unit1.pptx
 
CS8392 OOP
CS8392 OOPCS8392 OOP
CS8392 OOP
 
Presentation on Core java
Presentation on Core javaPresentation on Core java
Presentation on Core java
 
Complete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept itComplete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept it
 
Java chapter 1 basic introduction Unit-1.pptx
Java chapter  1 basic introduction Unit-1.pptxJava chapter  1 basic introduction Unit-1.pptx
Java chapter 1 basic introduction Unit-1.pptx
 
Java buzzwords.pptx
Java buzzwords.pptxJava buzzwords.pptx
Java buzzwords.pptx
 
Curso de Programación Java Intermedio
Curso de Programación Java IntermedioCurso de Programación Java Intermedio
Curso de Programación Java Intermedio
 
Java basic
Java basicJava basic
Java basic
 
Java Introduction - Quipoin.pptx
Java Introduction - Quipoin.pptxJava Introduction - Quipoin.pptx
Java Introduction - Quipoin.pptx
 
Features of java
Features of javaFeatures of java
Features of java
 

Recently uploaded

Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 

L1 basics

  • 1. PROGRAMMING IN JAVA Introduction to JAVA Lecture 1: Genesis and overview of Java By Ravi Kant Sahu Asst. Professor, LPU
  • 2. Contents • What is JAVA? • What is OOP? • Why Java? • Characteristics of JAVA • Overview of Java. • The difference between Java and C++? • A Simple JAVA Program Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 3. What is JAVA? • Developed by Sun Microsystems (James Gosling) • A general-purpose Object-Oriented language • Based on C/C++ • Designed for easy Web/Internet applications • Widespread acceptance Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 4. What is Object Oriented Programming? Object-oriented programming is a method of implementation in which programs are organized as cooperative collections of objects, each of which represents an instance of some class, and whose classes are all members of one or more hierarchy of classes united via inheritance relationships. Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 5. Principles of OOP • All object-oriented programming languages provide mechanisms that help you implement the object-oriented model. • They are: • Encapsulation • Inheritance • Polymorphism Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 6. Data Encapsulation Encapsulation is the mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference and misuse. class Account { int x=10; float withdraw(); void deposit(float amount); float balance; } Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 7. Advantages of Encapsulation • Protection • Consistency • Allows change Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 8. Inheritance • Inheritance is the process by which one object acquires the properties of another object. • A class that is derived from another class is called a subclass (also a derived class, extended class, or child class). • The class from which the subclass is derived is called a super class (also a base class or a parent class). • A class which is a subtype of a more general class is said to be inherited from it. Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 9. Inheritance cont’d • The sub-class inherits the base class’ data members and member functions. • A sub-class has all data members of its base-class plus its own. • A sub-class has all member functions of its base class (with changes) plus its own. Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 10. Polymorphism • Polymorphism refers to a programming language's ability to process objects differently depending on their data type or class. • Generally, the ability to appear in many forms. • More specifically, it is the ability to redefine methods for derived classes. • For example, given a base class shape, polymorphism enables the programmer to define different area methods for any number of derived classes, such as circles, rectangles and triangles. No matter what shape an object is, applying the area method to it will return the correct results. Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 11. Why Java? Java is the Internet programming language. Java enables users to develop and deploy applications on the Internet for servers, desktop computers, and small hand-held devices. Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 12. Java, Web, and Beyond • Java Applets • Java Web Applications • Java can also be used to develop applications for hand-held devices such as Palm and cell phones Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 13. Characteristics of Java •Java Is Simple •Java Is Object-Oriented •Java Is Distributed •Java Is Interpreted •Java Is Robust •Java Is Secure •Java Is Architecture-Neutral •Java Is Portable •Java's Performance •Java Is Multithreaded •Java Is Dynamic Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 14. Characteristics of Java •Java Is Simple •Java Is Object-Oriented •Java Is Distributed •Java Is Interpreted •Java Is Robust •Java Is Secure •Java Is Architecture-Neutral •Java Is Portable •Java's Performance •Java Is Multithreaded •Java Is Dynamic Java is partially modeled on C++, but greatly simplified and improved. Some people refer to Java as "C++--" because it is like C++ but with more functionality and fewer negative aspects.
  • 15. Characteristics of Java •Java Is Simple •Java Is Object-Oriented •Java Is Distributed •Java Is Interpreted •Java Is Robust •Java Is Secure •Java Is Architecture-Neutral •Java Is Portable •Java's Performance •Java Is Multithreaded •Java Is Dynamic Java is inherently object-oriented. Although many object-oriented languages began strictly as procedural languages, Java was designed from the start to be object-oriented. Object- oriented programming (OOP) is a popular programming approach that is replacing traditional procedural programming techniques. One of the central issues in software development is how to reuse code. Object-oriented programming provides great flexibility, modularity, clarity, and reusability through encapsulation, inheritance, and polymorphism.
  • 16. Characteristics of Java •Java Is Simple •Java Is Object-Oriented •Java Is Distributed •Java Is Interpreted •Java Is Robust •Java Is Secure •Java Is Architecture-Neutral •Java Is Portable •Java's Performance •Java Is Multithreaded •Java Is Dynamic Distributed computing involves several computers working together on a network. Java is designed to make distributed computing easy. Since networking capability is inherently integrated into Java, writing network programs is like sending and receiving data to and from a file.
  • 17. Characteristics of Java •Java Is Simple •Java Is Object-Oriented •Java Is Distributed •Java Is Interpreted •Java Is Robust •Java Is Secure •Java Is Architecture-Neutral •Java Is Portable •Java's Performance •Java Is Multithreaded •Java Is Dynamic You need an interpreter to run Java programs. The programs are compiled into the Java Virtual Machine code called bytecode. The bytecode is machine-independent and can run on any machine that has a Java interpreter, which is part of the Java Virtual Machine (JVM). Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 18. Characteristics of Java •Java Is Simple •Java Is Object-Oriented •Java Is Distributed •Java Is Interpreted •Java Is Robust •Java Is Secure •Java Is Architecture-Neutral •Java Is Portable •Java's Performance •Java Is Multithreaded •Java Is Dynamic Java compilers can detect many problems that would first show up at execution time in other languages. Java has eliminated certain types of error-prone programming constructs found in other languages. Java has a runtime exception-handling feature to provide programming support for robustness. Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 19. Characteristics of Java •Java Is Simple •Java Is Object-Oriented •Java Is Distributed •Java Is Interpreted •Java Is Robust •Java Is Secure •Java Is Architecture-Neutral •Java Is Portable •Java's Performance •Java Is Multithreaded •Java Is Dynamic Java implements several security mechanisms to protect your system against harm caused by stray programs. Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 20. Characteristics of Java •Java Is Simple •Java Is Object-Oriented •Java Is Distributed •Java Is Interpreted •Java Is Robust •Java Is Secure •Java Is Architecture-Neutral •Java Is Portable •Java's Performance •Java Is Multithreaded •Java Is Dynamic Write once, run anywhere With a Java Virtual Machine (JVM), you can write one program that will run on any platform. Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 21. Characteristics of Java •Java Is Simple •Java Is Object-Oriented •Java Is Distributed •Java Is Interpreted •Java Is Robust •Java Is Secure •Java Is Architecture-Neutral •Java Is Portable •Java's Performance •Java Is Multithreaded •Java Is Dynamic Because Java is architecture neutral, Java programs are portable. They can be run on any platform without being recompiled. Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 22. Characteristics of Java •Java Is Simple •Java Is Object-Oriented •Java Is Distributed •Java Is Interpreted •Java Is Robust •Java Is Secure •Java Is Architecture-Neutral •Java Is Portable •Java's Performance •Java Is Multithreaded •Java Is Dynamic Java’s performance Because Java is architecture neutral, Java programs are portable. They can be run on any platform without being recompiled. Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 23. Characteristics of Java •Java Is Simple •Java Is Object-Oriented •Java Is Distributed •Java Is Interpreted •Java Is Robust •Java Is Secure •Java Is Architecture-Neutral •Java Is Portable •Java's Performance •Java Is Multithreaded •Java Is Dynamic Multithread programming is smoothly integrated in Java, whereas in other languages you have to call procedures specific to the operating system to enable multithreading. Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 24. Characteristics of Java •Java Is Simple •Java Is Object-Oriented •Java Is Distributed •Java Is Interpreted •Java Is Robust •Java Is Secure •Java Is Architecture-Neutral •Java Is Portable •Java's Performance •Java Is Multithreaded •Java Is Dynamic Java was designed to adapt to an evolving environment. New code can be loaded on the fly without recompilation. There is no need for developers to create, and for users to install, major new software versions. New features can be incorporated transparently as needed. Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 25. Java Disadvantages • Slower than compiled language such as C • an experiment in 1999 showed that Java was 3 or 4 times slower than C or C++ Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 26. Origin of Java • Generation • James Gosling & Patrick Naughton at 1990 • Goal : to develop distributed system which is applicable to electronic products(platform independent) Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 27. James Gosling • James Gosling is generally credited as the inventor of the Java programming language • He was the first designer of Java and implemented its original compiler and virtual machine • He is also known as the Father of Java. Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 28. Brief History of Java • In 1990, Sun Microsystems began an internal project known as the Green Project to work on a new technology. • In 1992, the Green Project was spun off and its interest directed toward building highly interactive devices for the cable TV industry. This failed to materialize. • In 1994, the focus of the original team was re-targeted, this time to the use of Internet technology. A small web browser called HotJava was written. • Oak was renamed to Java after learning that Oak had already been trademarked. Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 29. • In 1995, Java was first publicly released. • In 1996, Java Development Kit (JDK) 1.0 was released. • In 2002, JDK 1.4 (codename Merlin) was released, the most widely used version. • In 2004, JDK 5.0 (codename Tiger) was released. •The latest version of java is jdk 8.0. Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 30. JDK Versions •JDK 1.02 (1995) … 250 classes •JDK 1.1 (1996) … 500 classes •JDK 1.2 (1998) … 2300 classes •JDK 1.3 (2000) … 2300 classes •JDK 1.4 (2002) … 2300 classes •JDK 1.5 (2004) … 3500 classes •JDK 1.6 (2006) … 3500 classes •JDK 1.7 (2011) … 3500 classes •JDK 1.8 (2014) … 3500 classes Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 31. Java Platform Editions • A Java Platform is the set of APIs, class libraries, and other programs used in developing Java programs for specific applications. Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 32. There are 3 Java Platform Editions 1. Java 2 Platform, Standard Edition (J2SE) • Core Java Platform targeting applications running on workstations 2. Java 2 Platform, Enterprise Edition (J2EE) • Component-based approach to developing distributed, multi-tier enterprise applications 3. Java 2 Platform, Micro Edition (J2ME) • Targeted at small, stand-alone or connectable consumer and embedded devices Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 33. Java Development Kit (JDK) Java Development Kit (JDK) • Is a set of Java tools for developing Java programs • Consists of Java API, Java Compiler, and JVM Java Application Programming Interface (API) • Is prewritten code, organized into packages of similar topics Java Virtual Machine Java API MyProgram.java Hardware - Based Platform JDK JRE Java Virtual Machine (JVM) is an execution engine that runs compiled Java byte code. Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 34. Structure Overview of Java Hardware Platform OS Platform Java Virtual Machine Java APIs Sparc, Intel, Mac, HP ... Solaris, Windows, Mac, Linux .. OS application Language Primitives Auxiliary Window Tookit JDBCRMI Servlet API JavaBeans Etc. JDBC Drivers Web Server Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 35. Java life cycle •Java programs normally undergo four phases • Edit •Programmer writes program (and stores program on disk) • Compile •Compiler creates byte-codes from program (.class) • Load •Class loader stores byte-codes in memory • Execute •Interpreter: translates byte-codes into machine language Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 36. Java life cycle • Source code (.java) • Compiled into Byte codes (.class) , as (.exe) in c++ – The Java Application Programming Interface (API) • a large collection of ready-made software components. It is grouped into libraries of related classes and interfaces; these libraries are known as packages. – Java Virtual Machine (JVM) – Machine code Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 37. Java life, cont.. Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 38. JVM an Portability • Through the Java VM, the same application is capable of running on multiple platforms. Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 39. A Simple Java Program //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 40. Compiling Java Source Code Java was designed to run object programs on any platform. With Java, you write the program once, and compile the source program into a special type of object code, known as bytecode. The byte-code can then run on any computer with a Java Virtual Machine, as shown below. Java Virtual Machine is a software that interprets Java byte-code. Java Bytecode Java Virtual Machine Any Computer Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)
  • 41.
  • 42. Ravi Kant Sahu, Asst. Professor @ Lovely Professional University, Punjab (India)

Editor's Notes

  1. 이 TP에서는 자바의 생성 배경과 그 동안 자바가 어떻게 발전해 왔는지에 대해 설명한다.
  2. 목차 자바의 생성배경 자바를 사용하는 이유 과거, 현재, 미래의 자바 자바의 발전과정 버전별 JDK에 대한 설명 자바와 C++의 차이점 자바의 성능 자바 관련 산업(?)의 경향
  3. 자바는 Sun에서 수행된 Green Project 도중 만들어졌다. 자바의 원래 이름은 Oak였다. James Gosling과 Patrick Naughton은 computing의 “next wave”는 digital로 제어되는 가전과 컴퓨터라고 생각해 이에 알맞은 시스템으로 만들어진 것이다. 자바개발의 목적은 연구를 위한 것이 아니라 Product를 만들어 내기 위한 것이었다. 그래서 Star 7(*7)이라는 시스템을 만들어 냈는데 이 시스템은 작은 embedded OS를 가지는 SPARC기반 Hardware이다. (Star 7은 5’’ color LCD를 가지고 touch screen을 input device로 사용하며 무선 네트워킹이 가능한 PDA이다.) http://java.sun.com/people/jag/green
  4. In 1990, Sun Microsystems began an internal project known as the Green Project to work on a new technology. Its team originally considered C++ as the language to use but soon abandoned it for an entirely new language called Oak. In 1992, the Green Project was spun off and its interest directed toward building highly interactive devices for the cable TV industry. This failed to materialize. In 1994, the focus of the original team was re-targeted, this time to the use of Internet technology. A small web browser called HotJava was written. Oak was renamed to Java after learning that Oak had already been trademarked. In 1995, Java was first publicly released In 1996, Java Development Kit (JDK) 1.0 was released In 2002, JDK 1.4 (codename Merlin) was released, the most widely used version In 2004, JDK 5.0 (codename Tiger) was released, the latest version The name Java was coined at a local coffee shop frequented by some of the members. It is not clear whether the name is an acronym or not. However some accounts claim that it stands for the names of James Gosling, Arthur Van Hoff, and Andy Bechtolsheim. Others, that it is an acronym for Just Another Vague Acronym.
  5. Recognizing that one size doesn’t fit all, Sun has grouped its technologies into three editions. Java 2 Platform, Standard Edition (J2SE)The J2SE platform is a fast and secure foundation for building and deploying client-side enterprise applications. In today's .com world of nanosecond response times and information gratification, J2SE technology provides the speedy performance and high functionality that is demanded by Web users. For end users, J2SE technology enables faster and easier use of functionally rich Web applications, such as corporate intranets and interactive shopping aids for e-commerce. For enterprise developers, the improved J2SE technology serves as the base tool for creating sophisticated, valuable applications that can be brought to market quickly. Java 2 Platform, Enterprise Edition (J2EE)J2EE technology simplifies enterprise applications by basing them on standardized, modular and re-usable components called Enterprise JavaBeans™ (EJB™), providing a complete set of services to those components, and handling many details of application behavior automatically. By automating many of the time-consuming and difficult tasks of application development, J2EE technology allows enterprise developers to focus on adding value, that is, enhancing business logic, rather than building infrastructure. Java 2 Platform, Micro Edition (J2ME)J2ME technology specifically addresses the vast consumer space, which covers the range of extremely tiny commodities such as smart cards or a pager all the way up to the set-top box, an appliance almost as powerful as a computer. J2ME technology enables device manufacturers, service providers, and content creators to gain a competitive advantage and capitalize on new revenue streams by rapidly and cost-effectively developing and deploying compelling new applications and services to their customers worldwide. Each edition is a developer treasure chest of tools and supplies that can be used with a particular product. Note that there are packages developed and supported by Sun that are not part of any edition such as (java3d for 3d graphics).
  6. The Java platform is formed from two components: the Java Application Programming Interface (Java API) and the Java Virtual Machine (JVM). The Java API is a set of libraries that you can use to accomplish tasks like creating graphical user interfaces (GUIs), performing file input/output (I/O), or establishing network communication. The JVM is in charge of executing your code in a specific environment. A Java Development Kit (JDK) is a program development environment for writing Java applications. It consists of a runtime environment that "sits on top" of the operating system layer as well as the tools and programming that developers need to compile, debug, and run applications written in the Java language. The Java Runtime Environment (JRE), also known as Java Runtime, is part of the Java Development Kit (JDK), a set of programming tools for developing Java applications. The Java Runtime Environment provides the minimum requirements for executing a Java application; it consists of the Java Virtual Machine (JVM), core classes, and supporting files.