You are on page 1of 22

Presented by:

SUJOY KUMAR BASU


AP, Dept. of Computer Application
AEC, Asansol
Content
2

 What is J ava ?

 History of J a va

 Features of J a va

 Bytecode & J V M

 J I T Compiler

 Difference between C & J a va

 Difference between C++ & J a va


What is J a v a ?
3

 J ava is Object Oriented Programming language which is


Platform Independent.
 J ava programming language was originally developed by
S u n Microsystems which was initiated by J a m e s Gosling
and released in 1995 as core component of S u n
Microsystems' J ava platform (Java 1.0 [J2SE]).
 J ava is a first programming language which provide the
concept of writing programs that can be executed using the
web.
 The latest release of the J ava Standard Edition is J ava S E
14. With the advancement of J ava and its widespread
popularity, multiple configurations were built to suit
various types of platforms.
 For example: J 2 E E for Enterprise Applications, J 2 M E for
Mobile Applications.
History of J a v a
4

 J ava is a high level object-oriented programming language


developed by J a m e s Gosling at S u n Microsystems in the early
1990s.
 J a m e s Gosling was unhappy using C++ programming
language so he developed J ava .
 Originally designed in (1991) as a small language for
consumer electronics (cable boxes, toasters etc.)
 A team of S u n Microsystems in the guidance of J a m e s
Gosling decided to develop an advanced programming
language for the betterment of consumer electronic devices.
 They developed a platform independent software based on the
power of networks that can run on different application areas,
s uc h as computers and electronic devices.
 It was initially called 'Oak‘.
 It was renamed as 'JAVA' released in 1995 as a core
component of S u n Microsystems J ava platform.
Features of J a v a
5

S u n Microsystem s officially describes J a va withthe


following attributes:
1. Simple
2. Secure
3. Portable
4. Object-oriented
5. Robust
6. Multithreaded
7. Platform Independent
8. Interpreted
9. High performance
10 . Distributed
11. Dynamic
Features of J a v a ( CO N TD …)
6

Simple:
 J ava was designed to be simple and familiar to learn
language.
 Fundamental concepts can be grasped quickly as the
features borrowed from C & C++.
 Features were removed that led to poor programming
practices or were rarely used.
 It does not use pointers, goto statement, Preprocessor
header files etc.
 It also eliminates operator overloading & multiple
inheritance.
Features of J a v a ( CO N TD …)
7

Secure:
 Security becomes a n important issue for a language
that is used for programming on internet.
 J V M verifies all byte codes before execution & ensures

all programs follow the rules regarding object access and


usage.
 J a va ensures that program cannot gain access to
memory locations without proper authorization.
 When we use a J ava compatible Web browser, we can
safely download J a va applets without fear of viral
infection.
Features of J a v a ( CO N TD …)
8

Portable:

J a va ensure portability in 2 ways:


 The size of the primitive data types are machine
independent.

 Compiler generates platform independent byte codes


rather than native machine code, so it can be
implemented on any machine.
Features of J a v a ( CO N TD …)
9

Object-oriented:
 All coding and data reside within object and classes.
 J a va has built-In exception handling.
 Everything in J ava (except the primitive data types) is an
object.
 The object model in java is simple and easy to extend so
that complex programming problems can be reduced to
simple solutions.
 Extensive set of classes, arranged in packages
Example: java.awt, java.io, java.net .
Features of J a v a ( CO N TD …)
10

Robust:
 J a va is a robust language. It provides many safeguards to

ensure reliable code.


 J ava has strict rules for compile-time and runtime error

checking.
 J ava supports automatic garbage collection so all
memory corruptions or unauthorized memory accesses
are impossible.
 J ava also incorporates the concept of exception handling
which captures series errors & eliminates any risk of
crashing the system.
Features of J a v a ( CO N TD …)
11

Multithreaded :

 Th is feature allows u s to handle multiple tasks


simultaneously.
 Designed to run multiple threads.
 Easy to implement.
 Other systems have provided facilities via light weight
libraries, but J a v a has in-built language support.
 This feature greatly improves the interactive
performance of graphical application.
Features of J a v a ( CO N TD …)
12

Platform Independent:
 J a va program can be easily moved from one computer
system to another, any where & any time.
 Changes & upgrades of O S , Processor & System
resources will not force any changes in java program,
that is J ava is platform independent.
 For this feature J a va ha s become a popular language
for programming on Internet which interconnects
different kinds of system world wide.
Features of J a v a ( CO N TD …)
13

Compiled & Interpreted:


 J a va is both compiled & interpreted language.
 First, J a va compiler translate source code into
bytecode instruction. But bytecode are not machine
instruction.
 Secondly, J a va interpreter generates machine code
that can be directly executed by the machine that is
running the java program.
Features of J a v a ( CO N TD …)
14

High Performance:
 J a va Bytecode was efficiently designed so that it would
be easy to translate directly into native machine code
for high performance by using a Just-In-Time (JIT)
compiler.
 Since java is compiled & interpreted both, it is faster
than other interpreter language.
 Also multithreading capability provides the overall
execution speed of java program.
Features of J a v a ( CO N TD …)
15

Distributed:
 J a va is network friendly.
 J a va is designed as a distributed environment for
creating applications on internet, because it handles
TCP/IP protocol.
 J ava applications can open & access remote objects on
Internet as easily as they can do in a local system.
 Multiple programmers can work together on a single
project from multiple remote locations.
 Both data and programs can be shared on networks.
Features of J a v a ( CO N TD …)
16

Dynamic:
 Provides a highly dynamic runtime environment.
 Allows dynamically linking in new class libraries,
methods and objects.
 New code can be linked on demand from anywhere on
the network and new types can be created as needed
dynamically.
 This is crucial to the robustness of applet environment
in which small fragment of bytecode may be
dynamically updated on a running system.
Bytecode & J V M
17

 Bytecode is program code that ha s been compiled from source


code into low-level code designed for a software interpreter. It may
be executed by a virtual machine (such as a J VM) or further
compiled into machine code, which is recognized by the processor.
 Different types of bytecode use different syntax, which ca n be read
and executed by the corresponding virtual machine. A popular
example is J a va bytecode, which is compiled from J a va source code
and can be run on a J a va Virtual Machine (JVM).
 When a J a va program is executed, the compiler compiles that piece
of code and a Bytecode is generated for each method in that
program in the form of a .class file.
 A bytecode in J a va is the instruction set for J a va Virtual Machine
and acts similar to a n assembler.
 We ca n run this bytecode on any other platform. But the bytecode
is a non-runnable code that requires or relies on a n interpreter.
This is where J V M plays a n important part.
Bytecode & J V M ( C O N T D … )
18

Work flow of Bytecode & J V M :


Source
Code

Compiler

Bytecode

JVM

Machine
Code
J I T Compiler
19

 The Just-In-Time compiler is one of the integral parts of


the J ava Runtime Environment.
 It is mainly responsible for performance optimization of J ava -
based applications at run time or execution time.
 In general, the main motto of the compiler is increasing the
performance of an application for the end user and the
application developer.
 In order to speed u p the performance, J I T compiler
communicates with J V M at the execution time in order to
compile byte code sequences into native machine code.
 Basically, when using J I T Compiler, the native code is easily
executed by the hardware when compared to J V M Interpreter.
By doing so, there will be a huge gain in execution speed.
C Language vs J a v a
20

 J a va does not support pointer.


 J ava does not have a preprocessor directives.
 J a va does not include the C keywords like goto, sizeof,
typedef etc.
 J ava does not define the type modifier keywords auto,
extern, register, signed, unsigned etc.
 J a va does not contain the data types struct, union etc.
 J ava adds O O P features (Inheritance, polymorphism,
encapsulation, data abstraction etc.) that are not
present in C .
 J a va also add labeled ‘break’ & ‘continue’ statement.
C++ vs J a v a
21

 J a va does not support operator overloading.


 J a va does not have template classes as in C++.
 J a va does not support multiple inheritance.
 J a va does not use Pointer.
 J a va has replaced the destructor function with a
finalize() method.
 J a va does not support global variable.
 There in no header file in java.
Thank You.

You might also like