Simply open this ZIP file and follow the directions in the README file.
For convenience, the source code is also below.
We can learn quite a few things from this simple program.
Code Comments:
Single-line code comments (annotations) may be placed after a double-slash:
"// My nice comment here"
Multi-line code comments (annotations) may be placed between a slash-star and star-slash, like:
/* Another comment */
. This type of comment may be on one line or span multiple lines.
General Info:
The line "public class Greeter" is called the class header line.
We see that "{" (opener) is used to start a program component, and "}" (closer) is used to end it. The class itself, and each method has an opener and closer.
The code that follows the class header between the "{" and "}" is called the body of the class.
This is a method header line:
public void greet()
The code that follows the method header between the "{" and "}" is called the body of the method.
/*
Greeter.java
Last Modified: 2/5/19
A simple Java class
*/
public class Greeter
{
public void greet()
{
//Print out a greeting to the console
System.out.println("GREETINGS to you from a simple Java program!!");
}
}