Beruflich Dokumente
Kultur Dokumente
Java was conceived by James Gosling, Patrick Naughton, Chris Warth, Ed Frank, and Mike Sheridan at Sun Microsystems, Inc. in 1991 name with Oak In 1992 this can be used in hand held devices 1993 this cab be used in WWW applications the same team in 1994 Hotjava bower developed ,it is more popular internet users. is
This language was initially called Oak but was renamed Java in 1995 1996 java itself established not only internet program but also general purpose, and OOP 7/13/12 languages.
The Bytecode
Bytecode is a highly optimized set of instructions designed to be executed by the Java run-time system, which is called the Java Virtual Machine (JVM). That is, in its standard form, the JVM is an interpreter for bytecode. This may come as a bit of a surprise
7/13/12
Java Features
Simple
Simple
Java is simple because there are various features that makes the java as a simple language. Programs are easy to write and debug because java does not use the pointers explicitly, operator overloading , multiple inheritance, process header files, goto stement
7/13/12
Object-Oriented
To be an Object Oriented language, any language must follow at least the four characteristics.
7/13/12
Robust
Java
has
the
strong automatic
memory garbage
allocation and
collection mechanism.
7/13/12
Multithreaded
Java supports multithreaded programming, which allows you to write programs that do many things simultaneously.
7/13/12
Architecture-Neutral
One of the main problems facing programmers is that no guarantee exists that if you write a program today, it will run tomorroweven on the same machine Operating system upgrades, processor upgrades, and changes in core system resources can all combine to make a program malfunction
7/13/12
The Java compiler does this by generating byte code instructions, to be easily interpreted on any machine and to be easily translated into native machine code
7/13/12
Java enables the creation of crossplatform programs by compiling into an intermediate representation called Java bytecode. This code can be interpreted on any system that provides a Java Virtual Machine Other interpreted systems, such as BASIC, Tcl, and PERL, suffer from almost insoluble performance deficits. Java, however, was designed to 7/13/12
Distributed
Java is designed for the distributed environment of the Internet, because it handles TCP/IP protocols, HTTP and FTP are developed in java In fact, accessing a resource using a URL is not much different from accessing a file. Internet programmers can call functions on these protocols and can 7/13/12 access the files from any remote get
Dynamic
Dynamic Java programs carry with them substantial amounts of runtime type information that is used to verify and resolve accesses to objects at run time. This makes it possible to dynamically link code in a safe and expedient manner. Java is capable of dynamically linking in new class libries, methods and objects. 7/13/12
Portability
The feature Write-once-run-anywhere makes the java language portable provided that the system must have interpreter for the JVM. programs to be dynamically downloaded to all the various types of platforms connected to the Internet, some means of generating portable executable code is needed. the same mechanism that helps ensure security also helps create portability
7/13/12
Security
Java system verify all memory access but also ensure that no virus are communicated with applet Java achieves this protection by confining a Java program to the Java execution environment and not allowing it access to other parts of the computer. The absence of pointers that
7/13/12
Java environment
JDK (java development KIT) collection of tools Appletviewer ( java compatible browser) Javac ( compiler) Java (interpreter) Javap( dis assembler) : convert the bytcode to program Javah : produces the header files for
7/13/12
JAVA API
Language support package Utilities package Input /Out package Networking package AWT package Applet package
7/13/12
Integers
long 64 9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 int 32 2,147,483,648 to 2,147,483,647 short 16 32,768 to 32,767 byte 8 128 to 127
7/13/12
Floating-Point Types
Description
\uxxxx Hexadecimal UNICODE character (xxxx) \ \ \\ \r \n Single quote Double quote Backslash Carriage return New line (also known as line
7/13/12
Variables
The variable is the basic unit of storage in a Java program. A variable is defined by the combination of an identifier, a type, and an optional initializer. In addition, all variables have a scope, which defines their visibility, and a lifetime Declaring a Variable
type identifier [ = value][, identifier [= value] ...] ; 7/13/12
Arrays
One-Dimensional Arrays type var-name[ ]; int month_days[]; int month_days[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; Multidimensional Arrays int twoD[][] = new int[4][5];
7/13/12
Sample program
import java.io.*; import java.util.*; class Example { // Your program begins with a call to 7/13/12
Progrm-ii
import java.io.*; import java.util.*; class Example2 { public static void main(String args[]) { int num; // this declares a variable called num num = 100; // this assigns num the value 100 7/13/12
Using arrays
class Average { public static void main(String args[]) { double nums[] = {10.1, 11.2, 12.3, 13.4, 14.5}; double result = 0; int i; for(i=0; i<5; i++)
7/13/12
class TwoDArray { public static void main(String args[]) { int twoD[][]= new int[4][5];
7/13/12
01234 56789 10 11 12 13 14 15 16 17 18 19
7/13/12