In Java, any line starting with // is a comment. Comments are intended for users reading the code to better understand the intent and functionality of the program. It is completely ignored by the Java compiler. Compiler is an application that translates Java program to Java bytecode that computer can execute
In Java, every application begins with a class definition. In the program, HelloWorld is the name of the class, and the class definition is:
For now, just remember that every Java application has a class definition, and the name of the class should match the filename in Java.
This is the main method. Every application in Java must contain the main method. The Java compiler starts executing the code from the main method. For now, just remember that the mainfunction is the entry point of your Java application, and it's mandatory in a Java program. The signature of the main method in Java is:
The following code prints the string inside quotation marks Hello, World! to standard output (your screen). Notice, this statement is inside the main function, which is inside the class definition.