0% found this document useful (0 votes)
2 views30 pages

Java Introduction

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

Java Introduction

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

Fundamental of Java Programming

Unit – 1
Introduction to Java
What is JAVA?
Introduction to Java
 Java has taken the most popular languages of that time i.e. C and
C++ as base by considering its various features and removing their
limitations.

 With this they have develop a most simple, reliable, portable and
powerful language.
The father of Java – James Gosling
History of Java
Year Development
1990 Sun Microsystems decided to develop a special software for consumer
electronics devices. A Team has been formed to undertake this task.
James Gosling was the head of that team.
1991 The team announce a new language called “Oak”

1992 The team known as “Green Project” team, have demonstrated the use
of language on a list of home appliances.
1993 World Wide Web (WWW) gave support to Green Project Team and they
have started thinking for development of Web Applets
1994 A new Web browser called HotJava has been developed by the Team to
run applets.
1995 Oak was rename to Java due to some legal problems.

1996 Sun release Java Development Kit 1.0 (JDK 1.0)


History of Java
Year Development
1997 Sun release JDK 1.1

1998 Sun release Java 2 with JDK 1.2

1999 Sun release J2SE and J2EE

2000 JDK 1.3

2002 JDK 1.4

2004 JDK 1.5

2006 JDK 1.6


History of Java
Year Development
2011 Java Se 7

2014 Java Se 8

2017 Java Se 9

2018 Java Se 10
Why Java?
Execution of C program
Execution of Java program
Bytecode in Java
• Java bytecode is the instruction set for the Java Virtual Machine. As soon
as a java program is compiled, java bytecode is generated. In more apt
terms, java bytecode is the machine code in the form of a .class file. With
the help of java bytecode we achieve platform independence in java.

• Platform independence is one of the soul reasons for which James Gosling
started the formation of java and it is this implementation of bytecode
which helps us to achieve this. Hence bytecode is a very important
component of any java program.

• The set of instructions for the JVM may differ from system to system but
all can interpret the bytecode. A point to keep in mind is that bytecodes
are non-runnable codes and rely on the availability of an interpreter to
execute and thus the JVM comes into play.
Bytecode in Java
JVM
• JVM (Java Virtual Machine) is an abstract machine. It is a specification that
provides runtime environment in which java bytecode can be executed.
• JVMs are available for many hardware and software platforms (i.e. JVM is platform
dependent).

The JVM performs following operation:


• Loads code
• Verifies code
• Executes code
Provides runtime environment

JVM provides definitions for the:


• Memory area
• Class file format
• Register set
• Garbage-collected heap
• Fatal error reporting etc
Java Runtime Environment

Class
Loader
a.Java k
dis
h ard Byte code
m
d fro Verifier
Loa
a.class
Interpreter

Runtime
JRE
• Class Loader : The class loader loads all claases needed for
execution of a program. It provides security by seperating
classes that are imported from network source. This limits any
virus because local classes are always loaded first.

• Byte Code verifier: JVM put the code through a bytecode


verifier that tests the format of code and checks it for any
code that forges pointer, violates access right on
object,change in object code.
JDK
• The java development kit comes with a collection of tools that
are used for developing and running java programs.
• Appletviwer (for viewing java applet)

• Javac (java Compiler)

• Jdb(java Debugger)

• Javadoc (for creating HTML code)


Phase – I (Compilation)
Virtual
Java Program
Source Code
Java Compiler Machine
Byte Code

Phase – II (Interpretation)
Virtual
Java
Machine Output
Interpreter
Byte Code
Process of Building and Running Java Application
Text Editor

Java Source Code

javac (Compiler)

Java class file

java (Interpreter)

Java Program Output


Comparison between C++ and Java
(1) Java does not support Operator Overloading
(2) Java is platform independent while C++ is not.
(3) Java does not support multiple inheritance instead of that it uses
interface
(4) Java does not support global variable declaration
(5) Java does not use destructor instead of that it uses finalize()
method
(6) There are no header files in java
(7) Java does not have sizeof or typedef
(8) Java does not have struct and union
(9) Java does not have pointers
(10) Java uses Applet, Mutithreading, AWT, Event Hnadling,Servlets.
Java Editions
• J2EE

• J2ME

• J2SE
Features to Java
Java has various features which makes it simple, secure and compact. They are as
follows:

(1) Compiled and Interpreted


(2) Platform Independent and Portable
(3) Object Oriented
(4) Secure
(5) Distributed
(6) Familiar, Simple and Small
(7) Multithreaded and Interactive
(8) High Performance
(9) Dynamic and Extensible
Features to Java
(1) Compiled and Interpreted :
Usually a computer language is either
compiled or interpreted. But java combines both
the approaches. First java compiler translates the
source code into byte code instructions. Bytecodes
are not machine instructions so in second stage,
Java Interpreter generates machine code and
execute the code. So we can say that java is
Compiler and Interpreter.
Features to Java
(2) Platform Independent and Portable :
Java programs can be moved easily from one
system to another, anywhere and anytime. Due to
this reason only the java is the most popular
language on the internet. Java is Platform
independent because it does not generates the
machine code but it generates a code for JVM (Java
Virtual Machine) so the program can be run on any
machine without any problem.
Features to Java
(3) Object Oriented :
Java is pure Object Oriented Programming
Language. Almost everything in java is an object.
All programs, codes and data always resides inside
the objects and classes.
Features to Java
(4) Secure :
Java is a secure language. It has compile time
and run time checking for data types. On the other
hand java provides the assurance that no viruses
will be communicated with applets. One more
thing is java does not support pointers so no
question of memory address to user.
Features to Java
(5) Distributed :
Java is a language developed for distributed
language for creating application on networks. It
has ability to share both – data and programs. This
will allow the programmers at various remote
locations to work together on a single project.
Features to Java
(6) Simple, Small and Familiar :
Java is simple language because many of the
features are from C and C++. Again it removes
problems from C and C++ like (1) it does not
support pointers, (2) Preprocessors (3) goto
statement and many others.
Java is small language because it consist of
only Six packages.
It is familiar because it looks like C++. In other
words we can say “Java is simplified version of C++”.
Features to Java
(7) Multithreaded and Interactive :
Multithreading means handling multiple tasks
simultaneously. Means that we can do more then
one work at a time. E.g. listening music is one work
and download from internet is another work is the
example of Multithreading.
Through java we can develop programs for
interactive systems like cellphones, lcds etc.
Features to Java
(8) High Performance :
The performance of Java is quite impressive
because it uses compilation and interpretation
both. It gives a very much high performance to the
java programs. Java architecture has also reduce
the overheads which also improves the
performance.
Features to Java
(9) Dynamic and Extensible:
Java is dynamic language. It is capable of
creating new classes, methods and objects.
Java supports functions written in C or C++
also. This is known as native code. This native code
will bind with the code dynamically.
Java is Extensible because we can define our
own classes also which can be added to the pure
java language.

You might also like