Answer:
Answers to the code are given below with appropriate guidelines on definitions and how to properly run the code
Explanation:
//3 ways to comment are as follows:
//1. This is a one line comment.
/**
* 2. This is a documentation comment.
* @author Your name here
*
*/
/*
*3. This is a multiple line comment
* */
public class Comments {
//Driver method
public static void main(String[]args) {
/*
* All the text written inside the
* sysout method will be displayed on
* to the command prompt/console*/
System.out.println("Program comments are nonexecuting statements you add to a file for the purpose of documentation.\n");
System.out.println("3 ways to add comments in JAVA are as follows: \n");
System.out.println("1. One line comment can be written as:\n//Program comments are nonexecuting statements you add to a file for the purpose of documentation.\n");
System.out.println("2. MultiLine comment can be written as:\n/* Program comments are nonexecuting \n * statements you add to a file for the \n * purpose of documentation.\n */\n");
System.out.println("3. Documentation comment can be written as follows:\n/**\n * Program comments are nonexecuting statements you add to a file for the purpose of documentation.\n **/");
}
}
Steps to Run:
1. Make file named Comments.java, and copy paste the above code.
2. Open command prompt and then go to the directory where you have saved the above created file.
3. The before running compile the code by using command
javac Comments.java
4. Now, run the code by the below command
java Comments.
Congrats your assignment is done!!