Java syntax

  • ‚ÄčIn classes, methods, and other flow-control structures code is always enclosed in curly braces { }.
  • Each code statement must end with a semicolon


Comments


  • single-line comments  start with two forwars slashes //
  • multi-line comments start with forwars slash followed by asterisk /*  and end vice versa */ 

/*  This is also a

    comment spanning

    multiple lines */

Documentation comments

  • generate external documentation of your source code
  • These begin with a forward slash followed by two asterisks, and end with an asterisk followed by a forward slash.

/** This is a documentation comment */
/** This is also a

    documentation comment */

Javadoc is a tool which comes with JDK and it is used for generating Java code documentation in HTML format from Java source code which has required documentation in a predefined format.
When a documentation comment begins with more than two asterisks, Javadoc assumes that you want to create a “box” around the comment in the source code. It simply ignores the extra asterisks.

/**********************
This is the start of a method
***********************/