Saturday, February 25, 2012

Java

Java is one of the most popular programming languages in use today.  It was originally developed by James Gosling at Sun Microsystems (which has since merged into Oracle Corporation).  Originally called OAK, it was designed for handheld devices and set-top boxes.  Because OAK was unsuccessful, in 1995, Sun changed the name to Java, modified it to take advantage of the burgeoning World Wide Web, and released it as both a language and a platform.

The Java language is general-purpose, concurrent, class-based, and object-oriented.  It derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities. Java is network-savvy, reasonably robust, fairly secure, portable, architecture neutral, multithreaded, and generally high-performance .  Its applications are typically compiled to bytecode that is intepreted, at runtime, by a Java Virtual Machine (JVM) into machine code for the particular CPU the application is running on.   End-users commonly use a Java Runtime Environment (JRE) installed on their own machine for standalone Java applications, or a web browser for Java applets.

One variant of the "Hello World" code snippet for Java is shown below:

class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!"); // Display the string.
    }
}

A "Hello World" Java applet might look something like:

// Hello.java
import javax.swing.JApplet;
import java.awt.Graphics;

public class Hello extends JApplet {
    public void paintComponent(final Graphics g) {
        g.drawString("Hello, world!", 65, 95);
    }
}


No comments:

Post a Comment