963.introduction to java

Upload: palak-goyal

Post on 08-Apr-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/7/2019 963.Introduction to Java

    1/15

    Introduction to JAVA

  • 8/7/2019 963.Introduction to Java

    2/15

    What is JAVA?

    JAVA technology is both a programming languageand a platform.

    The Java programming language is the language in

    which Java applications, applets, servlets, andcomponents are written.

    The Java platform is the predefined set of Javaclasses that exist on every Java installation; theseclasses are available for use by all Java programs.

    The Java platform is also sometimes referred to asthe Java runtime environment or the core Java APIs(application programming interfaces).

  • 8/7/2019 963.Introduction to Java

    3/15

    History of Java

    B leads to C evolved into C++ sets the stages for Java

    In 1990, Sun Microsystems began a project called GreenProject to develop software for consumer electronics.James Gosling, a veteran engineer was assigned to thenew Green Project.

    Gosling began writing software in C++ for embedding intosuch items as toasters, VCRs etc. But soon he realized thatC++ was the wrong tool for the job as it is susceptible tobugs that can crash the system. Goslings solution to theproblems of C++ was a new language called Oak.

  • 8/7/2019 963.Introduction to Java

    4/15

    Oak preserved the familiar syntax of C++ butomitted the potentially dangerous features

    like explicit resource references, pointerarithmetic and operator overloading, etc.

    When the World Wide Web became popularin 1994, Sun realized that Oak was the

    perfect programming language for the Web.Thus in 1994, they completed work on aproduct known as Web Runnerwas laterrenamed as Hot Java. Finally, in 1995, Oak

    was renamed Java and the team announcedthat the Netscape Navigator Internet browserwould incorporate Java technology.

  • 8/7/2019 963.Introduction to Java

    5/15

    Features of Java

    Simple

    Architecture Neutral

    compiler loader

    .cpp

    C++ Compilation Process

    javac JIT

    (JVM)

    Java Compilation Process

    Source Code

    .cpp .exe.obj

    Native Code.class

    fileSource Code

    .java

  • 8/7/2019 963.Introduction to Java

    6/15

    Object Oriented Robust

    Secure

    Multithreaded

    Distributed

    Dynamic

    Automatic Memory Management and

    Garbage Collection

  • 8/7/2019 963.Introduction to Java

    7/15

    Advantages of Java

    Simple

    Fewer bugs and reusable code

    We need to write less code

    Avoid platform dependencies. (Write once,run everywhere)

    Automatic version check

  • 8/7/2019 963.Introduction to Java

    8/15

    Windows/Pentium

    System

    UNIX

    System

    SERVER

    Class FilesContaining

    Bytecodes

    Class Loader

    Bytecode Verifier

    JIT

    Class Loader

    Bytecode Verifier

    JIT

    UNIX system

    machine levelinstructions(native code)

    Pentium system

    machine levelinstructions

    (native code)

    (JVM)

    NETWORK

    Working of Java

  • 8/7/2019 963.Introduction to Java

    9/15

    Additional class

    files needed by the

    program may be

    stored on disk ornetwork

    Main Program

    consisting of Java

    bytecode in a

    class file

    Class Loader

    Bytecode Verifier

    Execution Unit

    JVM

    Embedded in

    Browser

    Client System

    Internet

    Server

    Server

    Working of JAVA on Internet

  • 8/7/2019 963.Introduction to Java

    10/15

    JAVA Platform, JDK, JRE

    Java Platform A platform is a h/w or s/w environment inwhich a program runs. Most platforms can be describedas a combination of the operating system and underlyingarchitecture. The Java platform differs from others in thatits a s/w only platform that runs on the top of other h/w

    based platforms. JDK Java Development toolKit is a bundle of s/w to

    develop java based applications.

    JRE Java Runtime Environment is an implementationof JVM to execute java programs. JRE consists of twocomponents:

    JVM

    The Java Application Programming Interface (API)

  • 8/7/2019 963.Introduction to Java

    11/15

    JVM Java Virtual Machine

    a virtual machine (VM) is a s/w implementation of a

    machine (computer) that executes programs like a realmachine.

    A .class file does not contain code that is native toour processor. It instead contains bytecodes themachine language of the JVM. The Java launcher tool

    then runs our application with an instance of the JVM.Because the JVM is available on many differentoperating systems, the same .class files are capableof running on different platforms.

    API the API is a large collection of readymade s/w componentsthat provide many useful capabilities. It is grouped intolibraries of related classes and interfaces ; these librariesare known as packages.

  • 8/7/2019 963.Introduction to Java

    12/15

    Steps to createand executea Java

    program Creating a program using an editor

    Compiling a Java Program into Byte codes

    Loading a Program into Memory

    Byte code Verification

    Execution

  • 8/7/2019 963.Introduction to Java

    13/15

  • 8/7/2019 963.Introduction to Java

    14/15

    Java Versions & Environments

    Till now Java has undergone three significant versionchanges.

    It was first launched as Java 1.0, which is stillextensively supported by a majority of browsers.

    Then came Java 1.1, which had a languageenhancements, an improved user interface, andevent handling.

    Finally Sun has come up with the latest version as

    Java 1.2.2 which it callsJava 2.

    Java is available in many environments. Javasoftware is most easily available as JDK (JavaDevelopment Toolkit) version 1.0, 1.1 or 1.2.

  • 8/7/2019 963.Introduction to Java

    15/15

    There are many other development

    e

    nvi

    ronme

    nts for Jav

    a.Some of them are:

    Java Workshop

    Borland Jbuilder

    Symantec Visual Caf

    Visual Java (VJ++)

    Supercede etc.