Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
20 views

java overview-unit I

JAva

Uploaded by

cmptup2020
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

java overview-unit I

JAva

Uploaded by

cmptup2020
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 48

JAVA AND ITS

EVOLUTION

Ms.C.Mohana Priya
M.Sc(CT).,M.Phil.,SET.,
Asst Prof,
Dept of Computer Applications,
Tiruppur Kumaran College for Women,
CONTENTS
 Java Introduction
 Java Features
 How Java Differs from other OO languages
 Java and the World Wide Web
 Java Environment
 Build your first Java Program
 Summary and Reference
JAVA - AN INTRODUCTION
 Java - The new programming language developed by Sun
Microsystems in 1991.
 Originally called Oak by James Gosling, one of the inventors
of the Java Language.
 Java is an island of Indonesia where the first coffee was
produced (called java coffee).
 It is a kind of espresso bean. Java name was chosen by
 James Gosling while having coffee near his office.
 Java is really “C++ -- ++ “
JAVA INTRODUCTION
 Originally created for consumer electronics (TV,
VCR, Freeze, Washing Machine, Mobile Phone).
 Java - CPU Independent language
 Internet and Web was just emerging, so Sun
turned it into a language of Internet
Programming.
 It allows you to publish a webpage with Java
code in it.
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.

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.
JAVA MILESTONES
Year Development
1994 The team developed a new Web browsed called “Hot Java” to locate
and run Applets. HotJava gained instance success.

1995 Oak was renamed to Java, as it did not survive “legal” registration.
Many companies such as Netscape and Microsoft announced their
support for Java
1996 Java established itself it self as both 1. “the language for Internet
programming” 2. a general purpose OO language.

1997- A class libraries, Community effort and standardization, Enterprise


Java, Clustering, etc..
HISTORY OF JAVA
Java is a general purpose object oriented
programming language.
Developed by Sun Microsystems. (James Gostling)
Initially called “Oak” but was renamed as “Java” in
1995.
Initial motivation is to develop a platform
independent language to create software to be
embedded in various consumer electronics devices.
Become the language of internet. (portability and
security).
FEATURES OF JAVA
1. Compiled and Interpreted
2. Platform Independent and portable
3. Object Oriented
4. Robust and Secure
5. Distributed
6. Simple, Small and Familiar
7. Multithreaded and Interactive
8. High Performance
9. Dynamic
COMPILED AND INTERPRETED
Java works in two stage
Java compiler translate the source code into byte code.
Java interpreter converts the byte code into machine level
representation.
Byte Code:
-A highly optimized set of instructions to be executed by tehe java
runtime system, known as java virtual machine (JVM).
-Not executable code.
Java Virtual Machine (JVM):
- Need to be implemented for each platform.
- Although the details vary from machine to machine, all JVM
understand the same byte code.
JAVA VIRTUAL MACHINE

Java compiler produces an intermediate code known as byte code for


a machine, known as JVM.
It exists only inside the computer memory.

Java Program Java Compiler Virtual Machine

Machine code is generated by the java interpreter by acting as an


intermediary between the virtual machine and real machine.

Bytecode Java Interpreter Machine Code


PLATFORM INDEPENDENT AND PORTABLE

“Write-Once Run-Anywhere”-easily moved from one


computer to other
Changes in system resources will not force any change in
the program.
The Java Virtual Machine (JVM) hides the complexity of
working on a particular platform
Convert byte code into machine level representation.
OBJECT ORIENTED
Fundamentally based on OOP
Classes and Objects
Efficient re-use of packages such that the
programmer only cares about the interface and not
the implementation
The object model in java is simple and easy to
extend.
ROBUST AND SECURE

Designed with the intention of being secure


- Robust means reliable
No pointer arithmetic or memory management!
Strict compile time and run time checking of data
type.
Exception handling
It verify all memory access
Ensure that no viruses are communicated with an
applet.
DISTRIBUTED

 Java grew up in the days of the Internet


 Java applications open and access remote objects as
they do in local systems.
 Share data and programs.
SIMPLE, SMALL AND FAMILIAR

Similar to C/C++ in syntax


But eliminates several complexities of
No operator overloading
No direct pointer manipulation or pointer arithmetic
No multiple inheritance
No malloc() and free() – handles memory
automatically
MULTITHREADED AND INTERACTIVE

Handles multiple tasks simultaneously.


Java runtime system contains tools to support
multiprocess synchronization and construct smoothly
running interactive systems.
HIGH PERFORMANCE

Java performance is impressive for an interpreted


language.
Provisions are added to reduce overhead at runtime.
Incorporation of multithreading enhance the overall
execution speed.
DYNAMIC AND EXTENSIBLE

Capable of dynamically linking a new class libraries,


methods and objects.
Java can use efficient functions available in C/C++.
Installing new version of library automatically
updates all programs
EASE OF DEVELOPMENT

 Some features reduce the work of programmer by creating


reusable code
 Generics,enhanced for loop,autoboxing and unboxing
etc..are those features
 Each feature is designed to develop java programs in
easier way
MONITORING AND MANAGEABILITY

 Java monitoring and management API s,JMX-java


management extension to monitor and manage java
applications.
 Tools such as jconsole,jps,jstat are used monitoring
facilities.
 GUI based tool called jconsole to monitor JVM
DESKTOP CLIENT

 J2SE 5.0 to meet challenges of desktop user.


 Ocean feature mainly used for graphics application.
MISCELLANEOUS FEATURES

 Core XML support


 Supplementary character support-32 bit char support,
surrogate codepoint –supplementary characters
 JDBC Rowset-to send data in tabular format between
remote components.
JAVA IS COMPILED AND INTERPRETED

Hardware and
Programmer
Operating System

Source Code Byte


Code
Text Editor Compiler Interpreter
.java file .class
file java
Notepad, java
emacs,vi c appletviewer
netscape
TOTAL PLATFORM INDEPENDENCE

JAVA COMPILER
(translator)

JAVA BYTE CODE


(same for all platforms)

JAVA INTERPRETER
(one for each different system)

Windows 95 Macintosh Solaris Windows NT


HOW DOES JAVA COMPARES TO
C++ AND OTHER OO LANGUAGES
OVERLAP OF C, C++, AND JAVA

C++

C Java
JAVA AND C

 No sizeof,typedef
 No struct and union
 No type modifiers auto,extern,register,signed
 No preprocessors
 No void keyword
 Java adds instanceof,break,continue
JAVA BETTER THAN C++ ?
 No Typedefs, Defines, or Preprocessor
 No Global Variables
 No Goto statements
 No Pointers
 No Unsafe Structures
 No Multiple Inheritance
 No Operator Overloading
 Java replaced destructor with finalize() function
 No header files
JAVA AND INTERNET

 We can develop two types of Java programs:

 Stand-alone applications
 Web applications (applets)

First application in java is hotjava


APPLICATIONS V/S APPLETS
 Different ways to run a Java executable are:
Application-
A stand-alone program that can be invoked from command
line .
A program that has a “main” method

Applet-
A program embedded in a web page , to be run when the
page is browsed .
A program that contains no “main” method
APPLETS V/S APPLICATIONS

 Different ways to run a Java executable are


Application- A stand-alone program that can be
invoked from command line . A program that
has a “main” method
Applet- A program embedded in a web page , to
be run when the page is browsed . A program
that contains no “main” method
 Application –Executed by the Java interpreter.
 Applet- Java enabled web browser.
JAVA AND WORLD
WIDE WEB
Turning the Web into an Interactive and Application
Delivery Platform
WHAT IS WORLD WIDE WEB ?

 Web is an open-ended information retrieval system designed


to be used in the Internet wide distributed system.
 It contains Web pages (created using HTML) that provide both
information and controls.
 Unlike a menu driven system--where we are guided through a
particular direction using a decision tree, the web system is
open ended and we can navigate to a new document in any
direction.
WEB STRUCTURE OF INFORMATION
SEARCH/NAVIGATION
JAVA INTERACTION WITH WEB
SIGNIFICANCE OF DOWNLOADING APPLETS

 Interactive WWW
 Flashy animation instead of static web pages
 Applets react to users input and dynamically change
 Display of dynamic data
 WWW with Java
POWER OF JAVA AND THE WEB

 Deliver applications, not just information


 Eliminate porting
 Eliminate end-user installation
 Slash software distribution costs
 Reach millions of customers - instantly
JAVA DEVELOPMENT KIT

javac - The Java Compiler


java - The Java Interpreter
 jdb- The Java Debugger
 appletviewer -Tool to run the applets
 javap - to print the Java bytecodes
 javaprof - Java profiler
 javadoc - documentation generator
 javah - creates C header files
JAVA ENVIRONMENT
PROCESS OF BUILDING AND RUNNING JAVA PROGRAMS

Text Editor

Java Source
javadoc HTML Files
Code

javac

Java Class File javah Header Files

java jdb

Output
LET US TRY OUT

Building your first Java Program


HELLO INTERNET

// hello.java: Hello Internet program


class HelloInternet
{
public static void main(String args[])
{
System.out.println(“Hello Internet”);
}
}
PROGRAM PROCESSING

 Compilation
# javac hello.java
results in HelloInternet.class
 Execution
# java HelloInternet
Hello Internet
#
SIMPLE JAVA APPLET

//HelloWorld.java
import java.applet.Applet;
import java.awt.*;

public class HelloWorld extends Applet {


public void paint(Graphics g) {
g.drawString (“Hello World !”,25, 25);

}
}
CALLING AN APPLET

<HTML>
<TITLE>HELLO WORLD APPLET</TITLE>
<HEAD>THE HELLO WORLD APPLET</HEAD>
<APPLET CODE=“HelloWorld.class” width=500 height=500>
</APPLET>
</HTML>
APPLET EXECUTION

Using AppletViewer

Using Browser
SUMMARY

 Java has emerged as a general purpose OO


language.
 It supports both stand alone and Internet
Applications.
 Makes the Web Interactive and medium for
application delivery.
 Provides an excellent set of Tools for Application
Development.
 Java is ubiquitous!(means global or present
anywhere)

You might also like