Sei sulla pagina 1di 27

Introduction to Java

Topics

 JAVA Introduction
 JAVA Milestones
 JAVA Features
 JAVA Compilation and Interpretation
 JAVA Platform Independence
 Multi-Platform application
 JAVA Programming: The Edit / Compile / Run
 Some Sample Java Based Applications
JAVA – An Introduction

 JAVA is a general purpose, object oriented programming language developed by Sun


Microsystems of USA in 1991.
 Originally called Oak by James Gosling, one of the inventors of the JAVA Language.
 JAVA was designed for the development of software for consumer electronics devices like
TVs, VCRs, toasters and such other electronic machines.
 JAVA – platform independent language that means write once and run any where. Changes
and upgrades in operating systems, preprocessor and system resources will not force any
changes in JAVA programs.
 Internet and web was just emerging, so SUN turned it into a language of internet
programming .
JAVA – Milestones
Year Development
1990 Sun 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 with a tiny touch –
sensitive screen .
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.

1994 The team developed a new Web browser called “HotJava” to locate and
run Applets. Hot-Java gained instance success.
JAVA – Milestones
Year Development
1995 Oak was renamed to JAVA, due to some legal snags. JAVA is just a
name and is not a acronym. Many companies such as Netscape and
Microsoft announced their support for Java
1996 Java established itself ias both 1. “the language for Internet
programming” 2. a general purpose OO language. Sun released JDK
1.0
1997 JDK 1.1
1998 Sun released the Java 2 with version 1.2 of Software Development Kit
(SDK 1.2)
1999 2 platforms were released J2SE(Standard Edition), J2EE(Enterprises
Edition)
2000 and SDK 1.3 and SDK 1.4
2002
2004 J2SE with JDK 5.0 was released. This is know as J2SE 5.0
JAVA – Features

 Simple

 Object-Oriented

 Compiled and Interpreted

 Portable

 Robust
JAVA – Features

 Simple Java is partially modeled on C++,


but greatly simplified and improved.
 Object-Oriented Some people refer to Java as "C++--"
because it is like C++ but with more
 Compiled and Interpreted functionality and fewer negative
aspects.
 Portable

 Robust
JAVA – Features

 Simple Java is inherently object-


oriented. One of the central issues
in software development is how to
 Object-Oriented
reuse the code. Object-oriented
programming provides great
 Compiled and Interpreted flexibility, clarity, and reusability
through encapsulation, inheritance,
 Portable and polymorphism.

 Robust
JAVA – Features

 Simple

 Object-Oriented
JAVA combines both these
approaches thus making JAVA
 Compiled and Interpreted a two stage system. First, JAVA
compiler translates source
 Portable code into byte code which is
not machine code. In the
 Robust second stage java interpreter
generates machine code that
can be directly executed by the
machine that is running the
JAVA program.
JAVA – Features

 Simple

 Object-Oriented

 Compiled and Interpreted

 Portable
Java programs are portable.
 Robust They can be run on any
platform without being
recompiled.
JAVA – Features

 Simple

 Object-Oriented

 Compiled and Interpreted JAVA is a robust language. It provides


many safeguards to ensure reliable
 Portable code. It is designed as a garbage
collected language relieving the
 Robust programmers virtually all memory
management problems. JAVA
incorporates the concept of exception
handling which captures series errors
and eliminates any risk of crashing
system.
JAVA Compilation and Interpretation

 A program written in a high-level language must be translated into machine language before it
can be executed on a particular type of CPU
 A compiler is a software tool which translates source code into a specific target language.
 Typically, that target language is the machine language for a particular CPU type

source machine
compiler
code code
e.g.,
c, c++ gcc intel x86
HelloWorld.c HelloWorld.exe
JAVA Compilation and Interpretation
JAVA Translation:

 To be platform independent, JAVA cannot use the previous approach

 JAVA introduces an intermediate language called bytecode


 JAVA bytecode is not the machine language for any traditional CPU, but a virtual
machine.
 the JAVA compiler translates Java source code (.java files) into bytecode (in .class files).
 therefore the JAVA compiler is not tied to any particular machine.
 JAVA is thus considered to be platform independent.
JAVA Compilation and Interpretation
JAVA Execution:

 To execute a Java program, another piece of software called an interpreter , translates


between bytecode and the machine language.
 An interpreter is specific to a specific machine language.
 The interpreter understands java bytecode, and then issues instructions in the machine
language for which it is written.
 We also say that an interpreter provides a java virtual machine (JVM).
JAVA Compilation and Interpretation

Hardware and
Programmer
Operating System

Source Code Byte Code


Text Editor
Compiler Interpreter
/ IDE
.java file .class file
Notepad, javac java
emacs,vi,
Netbeans,
Eclipse etc.,
JAVA Platform Independence

 The most significant contribution of JAVA over other languages is its portability.
 JAVA programs can be easily moved from one computer system to another, anywhere and
anytime.
 Changes and upgrades in operating systems, preprocessors and system resources will not
force any changes in JAVA programs. This is the reason why JAVA has become a popular
language for programming on internet which interconnects different kinds of systems
worldwide.
JAVA Platform Independence

JAVA COMPILER
(translator)

JAVA BYTE CODE


(same for all platforms)

JAVA INTERPRETER
(one for each different system)

Windows Macintosh Solaris Windows NT


Multi-Platform application

The Java Virtual The Java


Machine (VM) is a compiler
program that generate
interprets Java bytecodes(.cl
bytecode into ass file)
machine code. A
JVM is a piece of
software that is
responsible for
running Java
programs.
Java Programming: The Edit/Compile/Run

 Programming in Java consists of three tasks


 edit java source code (.java files)
 compile java source code to generate
bytecode (.class files)
 execute/run/test bytecode using an
interpreter
Some Sample Java Based Applications
Hubble Space Telescope Monitoring:

 NASA Goddard’s most successful project


ever
 Launched in 1990.
 Has sensitive light detectors and cameras
 Provided view of galaxies up to 10 billion
light years away
Some Sample Java Based Applications
Mars Pathfinder Mission Simulator:

 Used for world-wide data viewing


 Winner of the 1997 NASA software of the
year
 The current rover location is displayed,
along with visual indications of “targets”
 Provides close-ups of the wedge
photograph
Some Sample Java Based Applications
IntelliBrain™ - Bot:

 Java Programmable
 RoboJDE™ java enabled robotics
software development environment
 Makes developing, debugging robotics
program a snap
Some Sample Java Based Applications
Star Office 5.2 :

 Cross platform Office suite completely


written in java
Some Sample Java Based Applications
Web Based Course Registration
System :
Some Sample Java Based Applications
Web Based Performance Review Management System :
Some Sample Java Based Applications
Web Based School Management System :
?

Potrebbero piacerti anche