This tutorial explains the installation and usage of the Java programming language. It also contains examples for standard programming tasks.
You should have already installed Java Development Kit (JDK). Otherwise, Read “How to Install JDK and Get Started with Java Programming”.
Let us begin by writing our first Java program that prints a message “Hello, world!” to the display console, as follows:
Step 1: Write the Source Code: Enter the following source codes using a programming text editor (such as TextPad or NotePad++ for Windows or gedit for UNIX/Linux/Mac) or an Interactive Development Environment (IDE) (such as Eclipse or NetBeans – Read the respective “How-To” article on how to install and get started with these IDEs).
Do not enter the line numbers (on the left panel), which were added to help in the explanation. Save the source file as “Hello.java”. A Java source file should be saved with a file extension of “.java”. The filename shall be the same as the classname – in this case “Hello”.