Many-line 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:

Yes.

Many-line Comments

Often you want to use several lines for a comment like this:
/* Program 1

Write out three lines of a poem.
The poem describes a single moment in time,
using 17 syllables.
*/

class Haiku
{
  public static void main ( String[] args )
  {
    System.out.println("On a withered branch" );
    System.out.println("A crow has just alighted:");
    System.out.println("Nightfall in autumn."); 
  }
}

With this style of comment, everything between the two characters /* and the two chracters */ are ignored by the compiler. The / and the * must not have any character between them. There can be many lines of comments between the /* pair and the */ pair.

QUESTION 15:

Why would you ever want to use comments to help a person understand your program?