Java Reference
In-Depth Information
return true;
else
if (year%100 == 0)
return false;
else
if (year%4 == 0)
return true;
else
return false;
}
This example introduces a method for determining whether or not a year is a leap
year.Theimportantpartofthiscodetounderstandisthemultilinecomment,whichcla-
rifiestheexpressionthatdetermineswhether
year
'svaluedoesordoesn'trepresenta
leap year.
Caution
You cannot place one multiline comment inside another. For example,
/*/* Nesting multiline comments is illegal! */*/
isnotavalid
multiline comment.
Javadoc Comments
A
Javadoc comment
(also known as a
documentation comment
) occupies one or more
linesofsourcecode.Thiscommentbeginswiththe
/**
charactersequence,continues
withexplanatorytext,andendswiththe
*/
charactersequence.Everythingfrom
/**
through
*/
isignoredbythecompiler.ThefollowingexampledemonstratesaJavadoc
comment:
/**
* Application entry point
*
* @param args array of command-line arguments passed to
this method
*/
public static void main(String[] args)
{
// TODO code application logic here
}