Friday, November 18

Comments in java codes - Java programming language

Comments are considered as a part of the java program components which allow to the programmer to describe some information about the program. It comes at the top like this one /* This is one line of comments */ , another example

/** This is another example 
* with length as the programmer wants to describe
* or the name of the program
* Develop3.java
* Author: Developer Jo
* A first program of a developer to improve programming skills and so.
* The description may range from short to long and very detailed description.
* We can also call these comments at the beginning of methods like this example
* header comments.
*/ 

 As you can see the beginning and ending markers are matched, each beginning marker /** or /* as it shown below should have a matching ending marker */.

/** Comment */

/* Comment */

 There is also another type of comments which come into the java program code to describe what is the purpose of this part of code or clarify as it shown by this steps.

Example:

JOptionPane.showMessageDialog(null, "Welcome user");   // Show message dialog or prompt

 Example:

/* Input Dialog asks the user about his/her name */
 
JOptionPane.showInputDialog(null, "What is your name" + "!");
  
The above example with red color ( any one of them ) is a comment and it won't affect the code even if you used first comment example in the middle of the code, but this one is a common among programmer to make the codes readable and documented in other way.

0 comments: