0% found this document useful (0 votes)
4 views25 pages

Java Language Evolution and Features

Java chapter 2

Uploaded by

minaketann3
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)
4 views25 pages

Java Language Evolution and Features

Java chapter 2

Uploaded by

minaketann3
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

Chapter 2

Java Evolution
2.1 History of Java
• Development of Java language project called “Green project” was initiated by
James Gosling, Patrick Naughton, Chris Warth, Ed Frank, and Mike Sheridan at Sun
Microsystems Inc., in 1991.
• This small team of sun engineers was called Green Team.
• Initially the language was called “Oak” by James Gosling, but was renamed “Java”
in 1995.
• The primary motivation was the need for a platform-independent (that is,
architecture-neutral) language that could be used to create software to be
embedded in various consumer electronic devices, such as microwave ovens, TVs,
toasters, and remote controls.
• Java is the first language that is not tied to any particular hardware or O.S.
• The second motive was to design a language which is “Internet Enabled”. To run
the programs on internet, Green project team come up with the idea of
developing “Web Applet”. The team developed a web browser called “Hot Java”
to locate and run applet programs on internet.
• Many Java features are inherited from the earlier languages: BCPL -> B-> C ->C++ -
>Java
• Java is based on C and C++.
2.1 History of Java
YEAR DEVELOPMENT
1990 Sun Microsystem decided to develop special software for electronic devices. The development
team known as “Green Team” was headed by James Gosling.
1991 The team announced a new language “OAK”, based on C++.
1992 Application of new language Oak was demonstrated for controlling home appliances with a hand
held device.
1993 World Wide Web (WWW) appeared on internet and transformed the text based internet to
graphical environment. Green Project Team developed of Web Applets.
1994 Green project team developed a web browser “Hot Java” to run applets on internet.
1995 Oak was renamed to JAVA. Many companies announced their support to Java.
1996 Sun released Java development kit 1.0.
1997 Sun released Java development kit 1.1(JDK 1.1).
1998 Sun released Java2 with version 1.2(SDK 1.2).
1999 Sun released Java2 standard edition (J2SE) and Enterprise Edition (J2EE).
2000 J2SE with SDK 1.3 was released
2002 J2SE with SDK 1.4 was released
2004 J2SE with JDK 5.0 was released
2006 Java SE 6 was released. J2SE was renamed as Java SE with removes ‘.0’.
2011 Java SE 7 was released
2.1 History of Java
Java Program Execution steps
2.2 Features of Java Programming
Language
2.2 Features of Java Programming
Language
1. Object-Oriented- Java strongly supports the concepts of Object-
Oriented Programming due to which it is called a pure object-
oriented language. Java supports major Object-Oriented
programming features like Encapsulation, Abstraction, and
Inheritance.
2. Simple, small, and familiar- Java is very easy to learn and its
syntax is simple. It removes complexity because it doesn’t use
complex and difficult features of other languages like C and C++,
which are as follows:
– Concept of Explicit Pointers
– Storage classes
– Preprocessors and header files
– Multiple Inheritance
– Operator Overloading
– Goto Statements
2.2 Features of Java Programming
Language
There is a provision of Automatic Garbage Collection, in which there is no need to
remove the unreferenced objects explicitly. It has a base of familiar languages like C
and C++ and contains many features of these languages. It contains user friendly
syntax for developing any applications.
3. Secure- Security is an important issue for any programming language as there is
a threat of malicious activities and viruses. Java is secured because:
– Java does not allow a programmer to explicitly create pointers. Thus, in Java,
we cannot gain access to, a particular memory location directly.
– Java programs run inside virtual machine sandbox, which does not allow its
access to other parts of the computer.
2.2 Features of Java Programming
Language
4. Platform Independent- The most significant feature of Java
is that it provides platform independence which leads to a
facility of portability, which ultimately becomes its biggest
strength. Being platform-independent means a program
compiled on one machine can be executed on any machine in
the world without any change. Java achieves platform
independence by using the concept of the platform
independent byte code. Java compiler converts the source
code into an intermediate code called the byte code and this
byte code is further translated to machine-dependent form
by another layer of software called JVM (Java Virtual
Machine). Therefore, JVM can execute bytecode on any
platform or OS on which it is present, regardless of the fact
that on which machine the bytecode was generated.
2.2 Features of Java Programming
Language

This is where the “Write Once, run anywhere” (WORA) slogan


for Java comes in, which means that the programs written on
one platform can run on any platform without doing any
modification in the code. But the platform used to execute
Java programs must have the Java Virtual Machine (JVM).
2.2 Features of Java Programming
Language
5. Robust: Robust simply means strong. Java is robust because-
• It has garbage collection mechanism that relieves the programmer from
memory management problems.
• It has a powerful exception handling mechanism to capture the errors
and eliminates the risk of system crash.
• It has strict compile time and run time type checking mechanism.
Compiler checks the program for errors and the interpreter checks for any
run time errors, thus preventing the system crash.

6. Portable: Java supports platform independent and architectural neutral


features therefore known as portable language.
• We can run Java bytecode on any hardware that has a compliant JVM
which can convert the bytecode according to that particular machine.
• In Java, the size of the primitive data types is machine-independent
(operating system or the processor), which were dependent in the case of
C/C++.
2.2 Features of Java Programming
Language
7. Architecture-neutral: Architecture represents processor. A Language
is said to be Architectural neutral which can run on any available
processors in the real world without considering the architecture
irrespective to its development and compilation.

8. Dynamic and Extensible - Java is a dynamic language. It is capable of


dynamically linking in new class libraries, methods, and objects. It also
supports functions from its native languages i.e. C and C++, thus
extensible.

9. Compiled and Interpreted- Usually, a computer language can be


either compiled or interpreted. Java integrates the power of Compiled
Languages with the flexibility of Interpreted Languages. Java compiler
(javac) compiles the java source code into the bytecode. Java
interpreter present on Virtual Machine (JVM) then converts the
bytecode into machine code which can be executed by the machine.
2.2 Features of Java Programming
Language
10. High-performance- Java is faster than other
traditional interpreted programming languages.
• Java provides high performance with the use of “JIT –
Just In Time compiler”. The Just-In-Time (JIT) compiler
dynamically generates machine code for frequently
used bytecode sequences in Java applications during
their execution.
• Java provides faster execution due to the uses of
bytecode.
• Garbage collector, collect the unused memory space
and improve the performance of application.
• The inclusion of multithreading enhances the overall
execution speed of Java programs.
2.2 Features of Java Programming
Language
11. Multi-threaded: Java supports multithreaded programming, which allows handling
multiple tasks simultaneously or executing multiple portions (functions) of the same
program in parallel. The main advantage of multi-threading is:
• The maximum utilization of resources is possible.
• There is no need to wait for the application to finish one task before beginning
another one.
• It improves the performance of complex applications.

12. Distributed- 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 a large projects with
collaboration. 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++.
2.3 How Java Differs from C and C++
Java and C:
1. Java is an OOP and C is a POP.
2. C is a compiled language that is it converts the code into machine language, whereas Java is both
compiled and interpreted language.
3. C is platform dependent, whereas Java is a platform independent.
4. Exception Handling is supported in Java.
5. Default members of C are public, whereas they are private in java.
6. C generally breaks down into functions, whereas Java breaks down into Objects.
7. C follows a top-down approach, whereas Java follows bottom-up.
8. Java does not include keywords: sizeof and typedef
9. It does not contain struct and union
10. It does not include storage classes: auto, extern, register, signed, and unsigned.
11. Java does not include pointer.
12. Java doesn’t have a preprocessor, therefore #define, #include, #ifdef are not supported.
13. Java uses empty parenthesis for no argument functions, whereas void keyword in used in C.
14. Java includes instanceof and >>> operators
15. Java includes labeled break and continue statements.
2.3 How Java Differs from C and C++

Java and C++:


1. Java doesn’t support operator overloading.
2. Java doesn’t support goto statement.
3. It doesn’t have template classes.
4. It doesn’t support multiple inheritance.
5. It doesn’t support global variable.
6. It doesn’t use pointer.
7. Destructor function has been replaced with finalize().
8. There is no header files in Java.
9. Java supports call by value only.
10. Java has no virtual keyword.
Java Ecosystem: JDK, JRE, and JVM
Java Ecosystem: JDK, JRE, and JVM
The Java Development Kit (JDK) – It is a software development
environment which is used to develop java applications and applets. It
contains JRE, JVM, Java APIs (classes and methods), and various
development tools such as-
• appletviewer - (It is used for viewing the applet)
• javac - (It is a Java Compiler)
• java - (It is a java interpreter which runs bytecode of applets and
applications)
• javap - (Java disassembler, which convert byte code into program
description)
• javah - (It is for producing C header files to be used with native
methods)
• javadoc - (It is for creating HTML format documentation file from
java source code file)
• jdb - (It is Java debugger to find errors)
Java Ecosystem: JDK, JRE, and JVM
Java Ecosystem: JDK, JRE, and JVM
Most commonly used API packages are:
• Language support packages- For implementing basic features.
Ex. String, Math, Thread, and System
• Utility packages-Utility functions such as date and time
• Input output packages
• Networking packages- For communication over internet
• AWT(Abstract Window Toolkit) and Swing- To implement
GUI.
• Applet package- To create applet
Java Ecosystem: JDK, JRE, and JVM
Java Runtime Environment (JRE)
Software package which is a part of the Java Development Kit (JDK),
that provides the necessary environment to run Java applications and
applets. It includes the following:
Java Virtual Machine (JVM): Interprets the bytecode and produces
desired output.
Runtime class libraries: Classes required for execution of a Java
program.
User Interface toolkits: ex. AWT and Swing. To interact with the java
application.
Deployment Technology:
Java Plug-in: Enables the execution of Java applet on Web-browser.
Java Web-start: It allows users to launch Java applications directly
from a web browser or a web server without installation.
Java Ecosystem: JDK, JRE, and JVM
JVM (Java Virtual Machine)-It provides runtime
environment in which java bytecode can be executed.
JVM is platform dependent. The JVM loads code,
verifies code, executes code, provides runtime
environment. JVM provides definitions for Memory
area, Class file format, Register set, Garbage-collected
heap, Fatal error reporting etc.
Java Ecosystem: JDK, JRE, and JVM
Java Ecosystem: JDK, JRE, and JVM
1. Class Loader Subsystem- It contains class loading, class linking,
Initialization modules.
2. Method Area- It contain class structures, method bytecode, and constant
pool information.
[Link]- A shared runtime data area where objects are allocated.
[Link]- Each thread has its own Java Stack, which stores frames. Each frame
contains local variables, partial results, and plays a part in method invocation
and return. A new frame is created each time a method is invoked. A frame is
destroyed when its method invocation completes.
[Link] Counter (PC) Register- It contains the address of the Java virtual
machine instruction currently being executed.
6. Native Method Stack- It contains all the native methods (methods written
in languages other than Java, like C or C++) used in the application.
7. Execution Engine- Contains a virtual processor, Interpreter and Just In Time
(JIT) compiler, Garbage Collector. Converts bytecode into machine code.
Java Ecosystem: JDK, JRE, and JVM
Key JDK(Java Development Kit) JRE(Java Runtime Environment) JVM (Java Virtual Machine)

Definition It is a software development kit to It is the implementation of JVM It is an abstract machine that is
develop applications in Java. In and is defined as a software platform-dependent and has
addition to JRE, JDK also contains package that provides Java class three notions as a specification (a
number of development tools libraries, along with Java Virtual document that describes
(compilers, JavaDoc, Java Machine (JVM), and other requirement of JVM
Debugger etc.), and APIs. components to run Java implementation), an
programs. implementation that meets JVM
requirements, and an
implementation that executes
Java byte code.
Prime functionality Code execution and development Responsible for creating Specifies all the implementations
environment for code execution and responsible to provide these
implementations to JRE.

Platform Independence platform dependent platform dependent Specification of JVM is platform


independent

Tools It contains tools for developing, It contains class libraries or APIs JVM does not include software
debugging and monitoring java and other supporting files that development tools.
application JVM requires to run the program.

Implementation JDK = Java Runtime Environment JRE = Java Virtual Machine (JVM) JVM = Only Runtime environment
(JRE) + Development tools + APIs + APIs for executing the Java byte code.

You might also like