Many Comments

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.

Answer:

No. Remember, the compiler completely ignores them. Comments are just for humans.

Many Comments

Comments can be placed after a program statement to explain what it does, as here:

class Haiku
{
  public static void main ( String[] args )
  {
    System.out.println("On a withered branch" );  // Write first line of the poem
    System.out.println("A crow has just alighted:");  // Write 2nd line of the poem
    System.out.println("Nightfall in autumn.");  // Write 3rd line of the poem
  }
}

As with all comments, the "//" and everything after it on that line are ignored by the complier. The program statement in the start of the line is not affected by the comment.

QUESTION 14:

Is it possible to write an entire paragraph of comments?