class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } }
javapoint java comments
to find a reference.
class HelloWorld {
class
is a keyword or reserved word.
javapoint java reserved words
HelloWorld
is the class name.
javapoint identifiers
public static void main(String[] args) {
public, static
and void
are reserved words
public
means that any class can access this method
static
is outside the scope of our discussion right now, but we need it
void
means that this method returns nothing. Don't worry about that.
main
tells the program where to "start" or begin.
main
is a standard identifier
String
args
.
String
is a Java class that supports a collection of letters
System.out.println("Hello World!");
System
is a Java class that supports interaction with the Operating system
System.out
is a subclass that supports interaction with the output system
System.out.println()
is a function that prints a line to the output.
"Hello World!"
is called a string literal
}
}
class ClassName { public static void main(String[] args) { // the code body } }