Introduction to Programming in Java

5. "Hello World"

5.1. Syntax and Comments

As mentioned above, Java is case-sensitive, meaning that if a variable name is "day" it cannot be referred to as "Day" later in the program. In addition, semicolons must end each statement in the code.

Programmers also use comments to insert statements into their code that the computer ignores. Comments can be used to help explain code so that other programmers can understand it or the original writer of the code can remember what their code does. Java has several types of comments.

System.out.println("Hello World!");//This is an inline comment


/*
 *This is a block comment
 */
System.out.println("Hello World!");


/**
 *This is a Javadoc comment
 */
public static void main (String[] args) 
{
  System.out.println("Hello World!");
}


Go to the Wikipedia article for Javadoc for more information on that type of comment.