This is the most commonly used beginner program out there. If you can understand this then you have the basic knowledge required for Java. However, if you don't understand this program then it is essential that you review the site again.
Class HelloWorld{
public static void main(string args[]) {
System.out.println("Hello World!"); }
}
Output: Hello World!
Since you are new to object-orientated programming, the concept of a class is new to you. We defined a new class, called HelloWorld. Always remember that Java is case sensitive, so HelloWorld is not the same as helloworld. A class is basically the definition for a segment of code that can contain both data (called attributes) and functions (called methods). When a class is executed, it looks for a particular method by the name of main. The main method is passed as a parameter an array of strings, and is declared as a static method. To output text from the program, we execute the println method of System.out, which is Java's output stream.