Tuesday, 10 November 2020

TYPES OF COMMENTS IN JAVA

 TYPES OF COMMENTS IN JAVA

Comments are statements which do not get executed and are written to explain the program clearly to the users.

There are 3 ways of writing comments in Java:

1. Single line comment: These are used when a comment can be expressed in a single line.

Example:

//Comment

2. Multi-line Comment: These are used when the comments are more than one line.

Example:

/*Comment........................................................................................................................................................................................................................................................................Comment*/

3. Documentation Comment: During the course of programming, the user may need to include some information about himself and his program. This documentation may not be a discussion about the program logic but might serve some some information to be viewed by other users who may need to execute your program.

Example:

/**.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................Comment*/




  

1 comment:

Java Program to count the total number of characters in a string

 //Java Program to count the total number of characters in a string import java.util.*; public class CountChars {     public static void mai...