0% found this document useful (0 votes)
3 views72 pages

01 Java Intro

Java, developed by Sun Microsystems in 1991, has evolved from its initial purpose for consumer electronics to a dominant programming language for internet applications. It features a unique architecture with the Java Virtual Machine (JVM) allowing cross-platform compatibility, and it has undergone significant updates to enhance performance and modern programming capabilities. As of 2025, Java remains widely used across various industries, with ongoing development and integration into emerging technologies.

Uploaded by

goyalmadhav196
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views72 pages

01 Java Intro

Java, developed by Sun Microsystems in 1991, has evolved from its initial purpose for consumer electronics to a dominant programming language for internet applications. It features a unique architecture with the Java Virtual Machine (JVM) allowing cross-platform compatibility, and it has undergone significant updates to enhance performance and modern programming capabilities. As of 2025, Java remains widely used across various industries, with ongoing development and integration into emerging technologies.

Uploaded by

goyalmadhav196
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Java and its Evolution

Java - An Introduction

• Java - The programming language developed


by Sun Microsystems in 1991.
• Originally called Oak after the tree that stood
outside of Gosling’s office by James Gosling,
one of the inventors of the Java Language.
• The name was changed because of a copyright
already owned by Oak technologies.
• Java -The name that survived a patent search
Java - An Introduction
• Other names that were considered were
Green, DNA, Silk, Neon, Pepper, Lyric,
NetProse, WRL (WebRunner Language),
WebDancer, and WebSpinner.
• Authors: James, Arthur Van, and others
• Java is really “C++ -- ++ “
Java Introduction
• Originally created for consumer electronics
(TV, VCR, Freeze, Washing Machine, Mobile
Phone).
• Java - CPU Independent language
• Internet and Web was emerging, so Sun
turned it into a language of Internet
Programming.
• It allows you to publish a webpage with Java
code in it.
Java Milestones
Year Development
1990 Sun (which has merged with Oracle Corporation) decided to
developed special software that could be used for electronic
devices. A project called Green Project created and head 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.
Java Milestones
Year Development
1994 The team developed a new Web browser called “Hot
Java” to locate and run Applets. HotJava gained instant
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 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..
Naming History
• The naming and the version number have been changing over times:
• Versions 1.0 and 1.1 are named as JDK (Java Development Kit).
• From versions 1.2 to 1.4, the platform is named as J2SE (Java 2 Standard
Edition).
• From versions 1.5, Sun introduces internal and external versions. Internal
version is continuous from previous ones (1.5 after 1.4), but the external
version has a big jump (5.0 for 1.5).
– This could make confusion for someone, so keep in mind that version 1.5 and version
5.0 are just two different version names for only one thing.
• From Java 6, the version name is Java SE X.
• Major versions were released after every 2 years, however the Java SE 7
took 5 years to be available after its predecessor Java SE 6, and 3 years for
Java SE 8 to be available to public afterward.
Compiled vs Interpreted
• Compiled
– Complied languages are firstly compiled to
machine executable then the machine executable
is run.
– Ex: C, C++
• Interpreted
– Interpreted languages are run from the source
code.
– Ex: Basic, Visual Basic, PHP, Perl
Compiler
• Let’s analyze how computer understands a
programming language.

Code Compile Run


Compiled Languages

Programmer

Source Code Object Executable


Code Code
Text Editor Compiler linker
.c file .o file [Link] file

Notepad, gcc
emacs,vi
Java Compiler: ByteCode
• All language compilers translate source code
into machine code for a specific computer.
• Java compiler also does the same thing
• The Java compiler produces the intermediate
code known as bytecode
Interpreter

Code Run
Java is Compiled and Interpreted
Hardware and
Programmer
Operating System

Source Code Byte Code


Text Editor Compiler Interpreter
.java file .class file

Notepad, java java


emacs,vi c appletviewer
netscape
What is a Virtual Machine?
• VM, as a "computer made of software" that you can
use to run any software you'd run on a physical
computer
• Software on top of a real hardware
• With virtualization, a single computer (host) can run
multiple virtual computers (VMs) each with their
own operating systems, processor cores, memory,
storage, and networking..
• A hypervisor is a software layer that enables virtual
machines to run on the host computer and
distribute processors, memory, and storage across
all VMs.
The Java Virtual Machine
• The heart of the Java platform is the concept of a "virtual
machine" that executes Java bytecode programs
• JVM is the virtual machine Java code executes on.
• Although Java programs are cross-platform or platform
independent, the code of the Java Virtual Machines (JVM)
that execute these programs is not.
• Every supported operating platform has its own JVM.
The Java Virtual Machine
• An abstract computing machine that
executes bytecode programs
– An instruction set and the meaning of those
instructions – the bytecodes
– A binary format – the .class file format
– An algorithm to verify the class file
The Java Virtual Machine
Implementations of the JVM
• Interpreter
– Simple, compact
– Slow
• Just-in-time compilation
– State-of-the-art for desktop/server
– translates the Java bytecode into native processor
instructions at run-time and caches the native code in
memory during execution.
Sun defines Java as:
• Simple and Powerful
• Safe
• Object Oriented
• Robust
• Architecture Neutral and Portable
• Interpreted and High Performance
• Threaded
• Dynamic
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 Platform-Independent
• Java Is Portable
• Java's Performance
• Java Is Multithreaded
• Java Is Dynamic
Characteristics of Java
• Java Is Simple Java is partially modeled on C++, but
• Java Is Object-Oriented greatly simplified and improved. Some
• Java Is Distributed people refer to Java as "C++--++"
• Java Is Interpreted because it is like C++ but with more
• Java Is Robust functionality and fewer negative aspects.
• Java Is Secure Java has more library functions than
• Java Is Architecture-NeutralC/C++ language, so the developer
• Java Is Platform-Independentfocuses only on the business logic
• Java Is Portable
• Java's Performance
• Java Is Multithreaded
• Java Is Dynamic
Characteristics of Java
• Java Is Simple Java is inherently object-oriented.
• Java Is Object-Oriented Although many object-oriented
• Java Is Distributed languages began strictly as procedural
• Java Is Interpreted languages, Java was designed from
• Java Is Robust the start to be object-oriented.
• Java Is Secure
• Java Is Architecture-Neutral
• Java Is Platform-Independent
• Java Is Portable
• Java's Performance
• Java Is Multithreaded
• Java Is Dynamic
Characteristics of Java
• Java Is Simple
Distributed computing involves several
• Java Is Object-Oriented
computers working together on a
• Java Is Distributed network. Java is designed to make
• Java Is Interpreted distributed computing easy. Since
• Java Is Robust networking capability is inherently
• Java Is Secure integrated into Java
• Java Is Architecture-Neutral
• Java Is Platform-Independent
• Java Is Portable
• Java's Performance
• Java Is Multithreaded
• Java Is Dynamic
Characteristics of Java
• Java Is Simple You need an interpreter to run Java
• Java Is Object-Oriented programs. The programs are compiled
• Java Is Distributed into the Java Virtual Machine code
• Java Is Interpreted called bytecode. The bytecode is
• Java Is Robust machine-independent and can run on
• Java Is Secure any machine that has a Java
• Java Is Architecture-Neutral interpreter, which is part of the Java
• Java Is Platform-Independent Virtual Machine (JVM).
• Java Is Portable
• Java's Performance
• Java Is Multithreaded
• Java Is Dynamic
Characteristics of Java
• Java Is Simple Java has the strong memory
• Java Is Object-Oriented allocation and automatic garbage
• Java Is Distributed collection mechanism.
• Java Is Interpreted
• Java Is Robust Java has eliminated certain types of
• Java Is Secure error-prone programming constructs
found in other languages.
• Java Is Architecture-Neutral
• Java Is Platform-Independent Java has a runtime exception-
• Java Is Portable handling feature to provide
• Java's Performance programming support for
• Java Is Multithreaded robustness.
• Java Is Dynamic
Characteristics of Java
• Java Is Simple
• Java Is Object-Oriented
• Java Is Distributed
• Java Is Interpreted
• Java Is Robust Java implements several security
• Java Is Secure mechanisms to protect your system
• Java Is Architecture-Neutral against harm caused by stray
• Java Is Platform-Independentprograms.
• Java Is Portable
• Java's Performance
• Java Is Multithreaded
• Java Is Dynamic
Characteristics of Java
• Java Is Simple
• Java Is Object-Oriented
• Java Is Distributed
• Java Is Interpreted
• Java Is Robust With a Java Virtual Machine (JVM),
• Java Is Secure you can write one program that will
• Java Is Architecture-Neutral run on any architecture.
• Java Is Platform-Independent
• Java Is Portable
• Java's Performance
• Java Is Multithreaded
• Java Is Dynamic
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 Platform-Independent Instead of translating source code
• Java Is Portable into native code, source code is
• Java's Performance transformed into the code of a
virtual machine
• Java Is Multithreaded
• Java Is Dynamic With a Java Virtual Machine
(JVM), you can write one
program that will run on any
platform.
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 Platform-Independent
• Java Is Portable
• Java's Performance Because Java is architecture
• Java Is Multithreaded neutral, Java programs are
• Java Is Dynamic portable. They can be run on any
platform without being recompiled.
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 Platform-Independent Java’s performance has
• Java Is Portable improved significantly due to the
• Java's Performance introduction of JIT technology:
• Java Is Multithreaded bytecode  native code
• Java Is Dynamic HotSpot Performance engine 
optimizing the frequently used
code
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 Platform-Independent
• Java Is Portable
• Java's Performance
• Java Is Multithreaded Multithread programming is
• Java Is Dynamic smoothly integrated in Java,
whereas in other languages you
have to call procedures specific to
the operating system to enable
multithreading.
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 Platform-Independent
• Java Is Portable Java was designed to adapt to an
• Java's Performance evolving environment. New code
can be loaded on the fly without
• Java Is Multithreaded
recompilation. There is no need for
• Java Is Dynamic developers to create, and for users
to install, major new software
versions. New features can be
incorporated transparently as
needed.
How Does Java Compares to C++
and Other OO Languages
Overlap of C, C++, and Java

C++

C Java
Java better than C++ ?

?
• No typedefs, defines, or Preprocessor
• No Global Variables
• No Goto statements
• No Pointers
• No Unsafe Structures
• No Multiple Inheritance
• No Operator Overloading
Object Oriented Paradigm: Features
Encapsulation

Data Abstraction

Single Inheritance

Polymorphism
OOP
Paradigm
Persistence

Delegation

Genericity

Multiple Inheritance
Java’s OO Features
Encapsulation

Data Abstraction

Single Inheritance

Polymorphism
OOP Java
Paradigm
Persistence

Delegation

Genericity

Multiple Inheritance
Java: Current Status (1)
• Java remains a highly relevant and widely used
programming language in 2025, despite its age. Its
current state is characterized by:
• Continued Popularity and Dominance:
– Java consistently ranks among the top programming
languages globally, with a significant presence in
enterprise-level applications, particularly in industries like
banking, finance, and retail.
– It is a primary language for a substantial percentage of
developers, and a large portion of Java developers have no
intention of migrating to other languages.
Java: Current Status (2)
• Active Development and Modernization:
– Oracle, the steward of Java, continues to release regular
updates, including new features and performance
enhancements. Java 24 is the current version as of March
2025, with Long-Term Support (LTS) versions like Java 8,
11, 17, and 21 still actively maintained.
– Modern features like functional programming constructs,
improvements in garbage collection, and advancements in
the JVM (Java Virtual Machine) through projects like
GraalVM and Project Loom are addressing historical
criticisms regarding verbosity, performance, and memory
consumption.
Java: Current Status (3)
• Broad Application and Ecosystem:
– Web Development:
– Frameworks like Spring and Spring Boot are widely used for building
robust web applications.
– Mobile Development:
– Java remains a key language for Android app development.
– Big Data and Cloud:
– Technologies such as Hadoop and Apache Spark leverage Java, making
it essential in big data processing and cloud computing environments.
– Emerging Technologies:
– Java is increasingly integrated with cutting-edge areas like machine
learning, IoT, and cloud-native applications, including microservices.
Java: Current Status (4)
• Evolving Deployment and Runtime:
– Oracle no longer provides a standalone JRE (Java Runtime
Environment) with JDK 11 and later. Instead, developers are
encouraged to use jlink tool to create custom, reduced-size
application runtimes containing only necessary modules.
• Jlink is a Java command line tool that is used to generate a custom Java runtime
environment (JRE). You can use your customized JRE to run Java applications. Using
jlink, you can create a custom runtime environment that only includes the relevant
class file.
– Alternative JRE distributions are available from sources like the Eclipse
Foundation's [Link].
• In essence, Java is not only maintaining its strong position but
also evolving to meet the demands of modern software
development, ensuring its continued relevance in the years to
come.
Java Environment
The Java Platform
• Refers to the entire Java development and execution
environment from Oracle.
• Originally developed by Sun, which Oracle acquired in
2010, Java programs are executed by a runtime engine
(the Java Virtual Machine) that must be installed in the
target computer.
• Since Java contains its own operating environment, it is
known as a "platform" in contrast to programming
languages such as C and C++ that, once compiled, run
natively and communicate with the operating system
directly.
The Java Platform
• The Java runtime components that must be installed in
the target machine to run Java applications come in
different flavours known as editions
• An edition of the Java platform is the name for a bundle
of related programs that allow for developing and
running programs written in the Java programming
language.
• The platform is not specific to any one processor
or operating system
Java Editions
• Java Editions are different versions of the Java platform, each
customized for specific types of applications and
environments.
• These editions are built on the same core Java language but
come with distinct libraries and APIs to meet different
programming needs.
• For instance,
– Java SE is designed for general-purpose desktop and server applications,
– Java EE extends those capabilities to large-scale enterprise solutions.
– Java ME caters to mobile and embedded devices, and
– Java FX focuses on building rich graphical user interfaces.
Editions of Java
• All these Java editions consist of an API (Application
Programming Interface) and JVM (Java Virtual Machine).
– The Java Virtual Machine (JVM) tool is used to run Java programs on a certain
platform.
– An API is used to build other software parts or programs.
– Each Java platform provides a virtual machine and an API to enable the
programs created for that platform to run on any compatible system and take
full use of the benefits of the Java programming language.
Java SE
• The Java Platform Standard Edition (Java SE) comprises
– APIs (Application Programming Interfaces) that provide Java's
fundamental programming features.
– It specifies every aspect of the Java programming language, from its
fundamental types and objects to its high-level classes for security,
Graphical User Interface development, database manipulation,
networking, etc.
• The Java SE Platform Includes:
– JVM (Java Virtual Machine),
– JDK (Java Development Kit),
– JRE (Java Run-time Environment), and
– Various class libraries.
– These components of Java SE are frequently used in Java technology
applications in extension to the main APIs.
Java EE
• The Java Enterprise Edition (Java EE) was developed to
expand the Java SE by adding a collection of
standards/specifications that describe frequently used
features by commercial applications. The most used features
of Java EE are:
– Java Server Pages (JSP): It is a server-side programming language that allows
constructing dynamic, device-independent ways to build web-based
applications.
– Java Server Faces (JSF): The JSF API offers elements such as inputText,
commandButtons, and others and assists in managing their states.
– Java Persistence API (JPA): Java developers get access to an object/relational
mapping mechanism through the Java Persistence API to manage relational
data in Java applications.
– Enterprise Java Beans (EJB): EJB is one of the many Java APIs used for
developing corporate applications. It is a server-side software component that
defines an application's business logic.
Java ME
• Java Micro Edition was developed to facilitate mobile and
embedded device applications.
• This edition is not quite as popular as other editions like Java
SE and Java EE, but recently, the Internet of Things (IoT)
gadgets have given this technology new hope.
• The Java ME platform offers an API and a small-footprint
virtual machine that helps run Java ME applications on
compact devices.
• Some examples of Java ME applications are given below:
– Calculator for Mobile, which demonstrates the functionality of multi-
threading.
– GPIO (General Purpose Input Output) applications.
– Location APIs, etc.
JavaFX
• JavaFX is a platform that provides a modern, hardware-accelerated
graphics and media engine for building rich online and desktop
applications.
• It uses a simple and powerful scripting language (JavaFX Script) to enable
the development of rich online, GUI, and Desktop applications.
• Some applications of JavaFX are given below:
– NEOS – New Eurovision Operations System used in Television media.
– Quote Monitor application is used in the field of finance.
– GEONS Ground System Software (GGSS) Nasa is used in space technology.
– FORUM Carl Zeiss Meditec AG is used in medicines.
Summary Java Editions
Java Edition Purpose Key Features & APIs Common Uses

Java SE General-purpose Core APIs (Collections, Desktop and server


(Standard computing Concurrency, applications
Edition) Networking, I/O)

Java EE Large-scale, distributed, Additional APIs Web applications,


(Enterprise and enterprise-level (Servlets, JSP, EJB, enterprise systems, e-
Edition) applications JPA, Web Services) commerce platforms

Java ME (Micro Mobile and embedded Lightweight APIs (CLDC, Mobile apps for feature
Edition) systems MIDP) phones, embedded
systems

Java FX Rich client-side APIs for GUI, media, Desktop apps with
applications graphics, animations modern user interfaces,
multimedia apps
J2SE
• J2SE, also known as Java Standard Edition, is the core
foundation of the Java platform. It primarily consists
of the
– Java Development Kit (JDK) and the
– Java Runtime Environment (JRE).

• J2SE is used to develop desktop applications and


provides the fundamental building blocks for all
other Java editions.
Java Development Kit

• The Java Development Kit (JDK) is an


implementation of either one of the Java SE, Java
EE or Java ME platforms

• The JDK comes with a complete Java Runtime


Environment. It consists of a Java Virtual
Machine and all of the class libraries present in the
production environment, as well as additional
libraries only useful to developers.
Java Development Kit
• The JDK is a set of command
line tools for developing Java
applications:
– javac - The Java Compiler
– java - The Java Interpreter
– jdb- The Java Debugger
– appletviewer -Tool to run the applets
– javap - to print the Java bytecodes
– javadoc - documentation generator
– javah - creates C header files
Java Runtime Environment
• Oracle's Java execution environment is termed
the Java Runtime Environment, or JRE
• JRE is the environment that provides
– the libraries,
– the Java Virtual Machine, and
– other components to run applets and applications
written in the Java programming language.
• A program may consist of many classes in different files. For
easier distribution of large programs, multiple class files may
be packaged together in a .jar file (short for Java archive).
Java Applications
• We can develop two types of Java programs:
– Stand-alone applications
– Web applications (applets)
Applications v/s Applets
Application- A stand-alone program that can be
invoked from command line . A program that has a
“main” method
Applications v/s Applets

A program embedded in a web page , to be run


when the page is browsed . A program that
contains no “main” method
Applications v/s Applets

Application Applet

• Executed by the • Java enabled


Java interpreter. web browser.
Java system overview
The Java Platform

• The Java programming language


• The Java Development Kit (JDK)
• The Java Runtime Environment (JRE)
• The Class library – the API
• The Java virtual machine (JVM)
Class Library - the Java API

The Java language is quite small.

Accompanying the language is a Class library (API)


Contains core classes.
Contains extensions to Java.
The Java API takes a long time to learn.

• Why has the industry largely adopted APIs?


Hide implementation details
Decreases Dependencies

• The Documentation is available and can be viewed at:


– [Link]
Rich Class Library

• Core Classes
Language
Utilities
Input/Output
Low-Level Networking
Abstract Graphical User Interface
• Internet Classes
TCP/IP Networking
WWW and HTML
Distributed Programs
Packages
The Java API classes are grouped into logical
units called "Packages".

Because there are so many classes, packages


provide a mechanism for classifying classes so
that they are easier to learn and use.

Developers can also make use of packages to


classify their own classes.
Commonly Used Packages
While it should be your goal to learn as many packages as you
can, there are some packages you will use more than others:
Language [Link] Common classes used for all
(general) application development

GUI [Link] Graphical User Interface,


[Link] Windowing,
[Link] Event processing

Misc. Utilities [Link] Helper classes, collections


and Collections

Input/Output [Link] File and Stream I/O

Networking [Link] Sockets, Datagrams


Commonly Used Packages and
their hierarchy
Relationship between JVM, JRE and JDK
Interaction of JDK, JVM and JRE

Simple summary: The JDK contains the JRE which contains the JVM.
Process of Building and Running Java
Programs
Text Editor

Java Source
javadoc HTML Files
Code

javac

Java Class File javah Header Files

java jdb

Output

You might also like