Java was developed by a team led by James Gosling at Sun Microsystems. Originally called Oak, it was designed in 1991 for use in embedded consumer electronic appliances. In 1995, renamed Java, it was redesigned for developing Internet applications.
Java is a full-featured, general-purpose programming language that is capable of developing robust mission-critical applications. Today, it is used not only for Web programming, but also for developing standalone applications across platforms on servers, desktops, and mobile devices. It was used to develop the code to communicate with and control the robotic rover that rolled on Mars. Many companies that once considered Java to be more hype than substance are now using it to create distributed applications accessed by customers and partners across the Internet. For every new project being developed today, companies are asking how they can use Java to make their work easier.
The Java programming language is a high-level language that can be characterized by all the following buzzwords:
• Simple
• Object oriented
• Distributed
• Interpreted
• Robust
• Secure
• Architecture neutral
• Portable
• High performance
• Multithreaded
• Dynamic
A Simple Java Program
A Java program can be written in many ways.
Let us begin with a simple Java program that displays the message "Welcome to Java!" on the console. The program is shown in Listing 1.1.
Every Java program must have at least one class. A class is a construct that defines data and methods. Each class has a name. By convention, class names start with an uppercase letter. In this example, the class name is Welcome.
In order to run a class, the class must contain a method named main. The JVM executes the program by invoking the main method.
A method is a construct that contains statements. The main method in this program contains the System.out.println statement. This statement prints a message "Welcome to Java!" to the console.
Creating, Compiling,