Sie sind auf Seite 1von 16

Java

Write Once, Run Anywhere

Presented By -Sayyan.N.Shaikh

History of Java
Java
was created in 1991 by James Gosling et al. of Sun Microsystems. Initially called Oak, in honour of the tree outside Gosling's window, later its name was changed to Java.

Based on C/C++
Designed for easy Web/Internet applications

Java
The original motivation for Java is to develop a platform independent language that could be embedded in various consumer electronic products like toasters and refrigerators. One of the first projects developed using Java a personal hand-held remote control named Star 7. At about the same time, the World Wide Web and the Internet were gaining popularity. Gosling et. al. realized that Java could be used for Internet programming.

Features of Java
Simple
It inherits some features of C and C ++ no pointers automatic garbage collection rich pre-defined class library

Object oriented
focus on the data (objects) and methods manipulating the data all functions are associated with objects almost all datatypes are objects (files, strings, etc.) potentially better code organization and reuse

Java Features (2)


Interpreted
java compiler generate byte-codes, not native machine code the compiled byte-codes are platform-independent java bytecodes are translated to machine readable instructions in runtime (Java Virtual Machine)

Portable
same application runs on all platforms Write once, run/debug anywhere the sizes of the primitive data types are defined and are always the same the libraries define portable interfaces

Java Features (3)


Reliable
extensive compile-time and runtime error checking no pointers but real arrays. Memory corruptions or unauthorized memory accesses is impossible automatic garbage collection tracks objects usage over time

Secure
simplified network access and usage access restrictions are forced (private, public) No Pointer is used Automatic memory management GC

Java Features (4)


Multithreaded
multiple concurrent threads of executions can run simultaneously It utilizes a sophisticated set of synchronization primitives (based on monitors and condition variables paradigm) to achieve this.

Dynamic
java is designed to adapt to evolving environment libraries can freely add new methods and instance variables without any effect on their clients interfaces promote flexibility and reusability in code by specifying a set of methods an object can perform, but leaves open how these methods should be implemented can check the class type in runtime

Phases of a Java Program

The following figure describes the process of compiling and executing a Java program

The Java Virtual Machine


It is an imaginary machine that is implemented by emulating software on a real machine. We can run the same application on different machines where the JVM is available

Byte code
It is a special machine language that can be understood by the Java Virtual Machine (JVM)

It is independent of any particular computer hardware, so any computer with a Java interpreter can execute the compiled Java program.

The .class files generated by the compiler are not executable binaries. So Java combines compilation and interpretation Instead, it make byte-codes to be executed by the Java Virtual Machine This approach provides platform independence to Java, and greater security

Java Advantages
Portable - Write Once, Run Anywhere! Well Secured. Robust memory management-Automatic garbage collection. Designed for network programming. Multi-threaded (multiple simultaneous tasks) Dynamic & extensible for loading the libraries Classes stored in separate files Loaded only when needed

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

Questions?

Thank you!

Das könnte Ihnen auch gefallen