20ES3102 Java Programming Unit I Chapter 1 Introduction, History, Features and The Evolution of Java
20ES3102 Java Programming Unit I Chapter 1 Introduction, History, Features and The Evolution of Java
Overview
• What is Java?
• Features of Java
Introduction
What is a Java Programming Language?
• It is a general-purpose high level compiled and interpreted
computer programming language designed to produce
programs that will run on any electronic device.
Contd.
• Java is a Platform.
– Platform means any hardware or software
environment in which a program runs.
• Since Java has its own Runtime Environment (JRE) it
referred as platform.
• Java is a software-only platform running on top of other,
hardware-based platforms.
• It was in the early 1990’s, when James Gostling came up with an idea
to develop small handheld device that remotely connects all home
appliances supports a programming language while working in Sun
Microsystems ( Later merged into Oracle Corporation).
Contd.
• Next Wave of Computing?
– Digitally controlled consumer devices.
• Small Embedded System in Electronic Appliances.
– Home Appliances like Set-Top Boxes, TV’s.
• New Product Designed and named Star *7
– They designed and built a new SPARC based software and handheld
wireless PDA (known as the Star7 or *7), with a 5" color LCD with touch
screen input, a new 16 bit 5:6:5 color.
• Star *7 was finished and demoed on September 3, 1992.
– One of the most interesting pieces of work that came out of it was a
business plan. User interface methodology which uses animation, audio,
spatial cues, gestures, agency, color, and fun. Fun and Engaging .
– Hardware and software combination, including a TV guide, a fully
functioning television remote control.
– Too Advanced and Expensive.
A.Raghuvira Pratap , Asst. Professor, CSE Department 6
20ES3102 Unit I Chapter 1 Introduction, History, Features and Differences
Contd.
Why the Name “Java”?
• Java is an island of Indonesia where first coffee was produced
(called java coffee).
• Java is a Island Famous for Coffee seeds.
• In 1995, Time magazine called Java one of the Ten Best Products
of 1995.
Contd.
Where it is used?
• Desktop Applications.
– A desktop application means any software that can be installed on a
single computer (laptop or a desktop) and used to perform specific
tasks such as acrobat reader, media player, antivirus etc.
• Web Applications.
– A web based application is a software package that can be accessed
through the web browser.
9
A.Raghuvira Pratap , Asst. Professor, CSE Department 9
20ES3102 Unit I Chapter 1 Introduction, History, Features and Differences
Contd.
• Mobile Applications.
– A mobile app is a software application designed to run on mobile
devices such as smartphones and tablet computers.
• Embedded Applications.
– A software application that permanently resides in an industrial or
consumer device.
Java Features/Buzzwords/Advantages
• Java is a Simple/Familiar Language
• Java is Platform Independent.
• Java is Compiled and Interpreted.
• Java is Portable.
• Java is a Dynamic Language.
• Java is Secured.
• Java is Robust.
• Java is a Distributed Language.
• Java is a Multithreaded Language.
• Java is Architecture Neutral.
• Java is High in Performance
• Java is a OOP Language.
A.Raghuvira Pratap , Asst. Professor, CSE Department 11
20ES3102 Unit I Chapter 1 Introduction, History, Features and Differences
Contd.
• Java is a Simple/Familiar Language:
• Simplicity of Java is the professional programmers could learn it quickly
and use effectively. [Familiar]
• From C, Java derives it Syntax and Many of Java’s OOP Features
inherited from C++.
• Java was designed to make it much easier to write bug free code.
[ Bug Free System ]
• Efficient Memory management [Automatic]
• Removed many confusing and/or rarely-used features e.g., structures,
unions, explicit pointers, typedef, operator overloading etc.
• Java Removes Complexity because it doesn’t use pointers, Storage Classes
and Go to Statements and java doesn’t support Multiple Inheritance.
• Java is a Platform Independent Language:
• The concept of Write-once-run-anywhere (known as the Platform
independent) is one of the important key feature of java language that
makes java as the most powerful language.
A.Raghuvira Pratap , Asst. Professor, CSE Department 12
Contd.
20ES3102 Unit I Chapter 1 Introduction, History, Features and Differences
• Contd.
• The programs written on one platform can run on any platform provided
the platform must have the JVM.
• Java code can be run on multiple platforms e.g. Windows, Linux, Sun
Solaris, Mac/OS etc. Java code is compiled by the compiler and converted
into bytecode.
• This bytecode is a platform independent code because it can be run on
multiple platforms i.e. Write Once and Run Anywhere(WORA).
• How it is Platform Independent Java’s Magic : ‘Bytecode’:
• Java bytecode is the instruction set of the Java virtual machine.
• Byte code is Highly Optimized set of instructions of Java Specification.
• It is also called as intermediate code. Also referred as Error free code.
• Byte code is also called as portable code. It is a form of instruction set
designed for efficient execution by a software.
• Bytecode is the compiled format for Java programs. Once a Java program
has been converted to bytecode, it can be transferred as a input and
executed by Java Virtual Machine (JVM).
• Bytecode files generally have a .class extension.
A.Raghuvira Pratap , Asst. Professor, CSE Department 13
Contd.
20ES3102 Unit I Chapter 1 Introduction, History, Features and Differences
Contd.
• Java is a Compiled and Interpreted Language:
• Usually, a computer language can be either compiled or interpreted. Java
integrates the power of Compiled Languages with the flexibility of
Interpreted Languages.
• Java is a compiled programming language, but rather than compile straight
to executable machine code, it compiles to an intermediate binary form
called JVM byte code. The byte code is then compiled
and/or interpreted to run the program.
• Compilation Java’s JVM Specific. Byte Code
• Interpretation Native CPU Specific. Executable Object code
• Java is a Portable language:
• Java is portable because it facilitates you to carry the Java bytecode to any
platform. It doesn't require any implementation.
• In C/C++, the source code may run slightly differently on different
hardware platforms, but Java simplifies it. You can run Java bytecode on
any hardware that has a compliant JVM which can convert the bytecode
according to that particular machine.
A.Raghuvira Pratap , Asst. Professor, CSE Department 15
20ES3102 Unit I Chapter 1 Introduction, History, Features and Differences
Contd.
• Contd.:
• The features expecting from the dynamic languages are automation,
memory management and exception handling, Non-static typing
mechanisms and specific syntax choices to promote better code readability
and significantly reduced code verbosity.
• Java is a distributed language:
• Java is distributed because it encourages users to create distributed
applications.
• In Java, we can split a program into many parts and store these parts on
different computers. A Java programmer sitting on a machine can access
another program running on the other machine.
• This feature in Java gives the advantage of distributed programming, which
is very helpful when we develop large projects. Java helps us to achieve this
by providing the concept of RMI (Remote Method Invocation) and EJB
(Enterprise JavaBeans).
• Java comes with an extensive library of classes for interacting, using
TCP/IP protocols such as HTTP and FTP, which makes creating network
connections much easier than in C/C++.
• Contd.
• Java supports major Object-Oriented programming features like
Encapsulation, Abstraction, and Inheritance.
• Almost everything in Java is an object. All programs and data live
within objects and classes. ‘Objects’ model Java rather than the
‘processes’. Java comes with an extensible set of classes organized in
packages.
• Object-oriented programming(OOPs) is a methodology that simplify
software development and maintenance by providing some rules.
• Basic concepts of OOPs are:
– Object
– Class
– Inheritance
– Polymorphism
– Abstraction
– Encapsulation
Contd.
• To some extend java is not considered as pure object oriented
programming .
• For any language to be pure object oriented it must follow these 6
points strictly.
1) It must have full support for Encapsulation and Abstraction
2) It must support Inheritance
3) It must support Polymorphism
4) All predefined types must be Objects
5) All user defined types must be Objects
6) Lastly, all operations performed on objects must be only through
methods exposed at the objects.
Contd.
• Java Runtime Environment
– JRE is an acronym for Java Runtime Environment. It is used to
provide runtime environment.
– Java Runtime Environment (to say JRE) is an installation package
which provides environment to only run(not develop) the java
program(or application)onto your machine.
– JRE is only used by them who only wants to run the Java Programs
i.e. end users of your system.
– It is the implementation of JVM. It physically exists. It contains set
of libraries + other files that JVM uses at runtime.
– 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.
JRE Vs JDK
JRE JDK
(Java Runtime Environment) (Java Development Kit)
It is an implementation of the Java Virtual Machine* It is a bundle of software that you can use to
which actually executes Java programs. develop Java based applications.
Java Runtime Environment is a plug-in needed for Java Development Kit is needed for developing
running java programs. java applications.
The JRE is smaller than the JDK so it needs less The JDK needs more Disk space as it contains
Disk space. the JRE along with various development tools.
The JRE can be downloaded/supported freely from The JDK can be downloaded/supported freely
oracle.com from
oracle.com/technetwork/java/javase/downloads/
It includes the JVM, Core libraries and other It includes the JRE, set of API classes
additional components to run applications and ,development tools Java compiler, Web start
applets written in Java. and additional files needed to write Java applets
and applications.
A.Raghuvira Pratap , Asst. Professor, CSE Department 25
20ES3102 Unit I Chapter 1 Introduction, History, Features and Differences
Contd.
• Java Virtual Machine
– JVM (Java Virtual Machine) is an abstract Machine. It is a specification that
provides runtime environment in which java byte code can be executed.
– Java Virtual machine(JVM) is a very important part of both JDK and JRE
because it is contained or inbuilt in both.
– Whatever Java program you run using JRE or JDK goes into JVM and JVM
is responsible for executing the java program line by line hence it is also known
as interpreter.
– Different JVM is designed for different OS and Hardware.
– JVM is a platform dependent , Where Java is Platform independent
– It is:
• A specification, where working of Java Virtual Machine is specified. But
implementation provider is independent to choose the algorithm. Its
implementation has been provided by Oracle and other companies.
• An implementation, Its implementation is known as JRE (Java Runtime
Environment).
• Runtime Instance, Whenever you write java command on the command
prompt to run the java class, an instance of JVM is created.
A.Raghuvira Pratap , Asst. Professor, CSE Department 26
20ES3102 Unit I Chapter 1 Introduction, History, Features and Differences
Contd.
Contd.
Contd.
• Consequence of Java’s history: platform-independent
Single class
Inheritance N/A Multiple class inheritance inheritance, multiple
interface implementation
Operator Overloading N/A Yes No
Automatic coercions Yes, with warnings if loss Yes, with warnings if loss Not at all if loss could occur;
(Conversion) could occur could occur must cast explicitly
Varied Parameters Yes Yes No
Goto Statement Yes Yes No