A Simple Java Application. OR Steps for creating and running Java program

September 14, 2010

public class HelloWorldApp
{
public static void main(String arg[])
{
System.out.println(“Hello World!”);
}
}
Save this code in a file called
HelloWorldApp.java

Step 2:

Compile the application with the command line
> javac HelloWorldApp.java

This creates the class file (with the bytecode output):
HelloWorldApp.class

Step 3:

Use the java command to run the program:
> java HelloWorldApp
Hello World!


Java Data and Variables

August 30, 2010

Integer Primitive Data Types

Type                       Size                                         Range

byte                       8  bits                                   -128 to +127

short                     16 bits                                -32,768 to +32,767

int                         32 bits                               (about)-2 billion to +2 billion

long                      64 bits                                (about)-10E18 to +10E18

Floating Point Primitive Data Types

Type                      Size                                         Range

float                       32 bits                                -3.4E+38 to +3.4E+38

double                   64 bits                                 -1.7E+308 to 1.7E+308


Java Virtual Machine

August 30, 2010

Java Virtual Machine (JVM), originally developed by Sun Microsystems, is a virtual machine that executes Java bytecode. This code is most often generated by Java language compilers, although the JVM has also been targeted by compilers of other languages. The JVM is a crucial component of the Java Platform. The availability of JVMs on many types of hardware and software platforms enables Java to function both as middleware and a platform in its own right. Hence the expression “Write once, run anywhere.” Starting with J2SE 5.0, changes to the JVM specification have been developed under the Java Community Process as JSR 924. As of 2006, changes to specification to support changes proposed to the class file format (JSR 202) are being done as a maintenance release of JSR 924. The specification for the JVM is published in book form, known as “blue book”. The preface states:

We intend that this specification should sufficiently document the Java Virtual Machine to make possible compatible clean-room implementations. Sun provides tests which verify the proper operation of implementations of the Java Virtual Machine. Kaffe is an example of a clean-room Java implementation. Sun retains control over the Java trademark, which it uses to certify implementation suites as fully compatible with Sun’s specification.


Five Primary Goals In The Creation Of The Java Language:

August 7, 2010

1. It should use the object-oriented programming methodology.
2. It should allow the same program to be executed on multiple operating systems.
3. It should contain built-in support for using computer networks.
4. It should be designed to execute code from remote sources securely.
5. It should be easy to use by selecting what was considered the good parts of other object-oriented languages.


History Of Java Programming

August 7, 2010

Java was started as a project called “Oak” by James Gosling in June 1991. Gosling’s goals were to implement a virtual machine and a language that had a familiar C-like notation but with greater uniformity and simplicity than C/C++. The first public implementation was Java 1.0 in 1995. It made the promise of “Write Once, Run Anywhere”, with free runtimes on popular platforms. It was fairly secure and its security was configurable, allowing for network and file access to be limited. The major web browsers soon incorporated it into their standard configurations in a secure “applet” configuration. popular quickly. New versions for large and small platforms (J2EE and J2ME) soon were designed with the advent of “Java 2”. Sun has not announced any plans for a “Java 3”.

In 1997, Sun approached the ISO/IEC JTC1 standards body and later the Ecma International to formalize Java, but it soon withdrew from the process. Java remains a proprietary de facto standard that is controlled through the Java Community Process. Sun makes most of its Java implementations available without charge, with revenue being generated by specialized products such as the Java Enterprise System. Sun distinguishes between its Software Development Kit (SDK) and Runtime Environment (JRE) which is a subset of the SDK, the primary distinction being that in the JRE the compiler is not present.