Ask Question
13 July, 06:23

Open Comments. java and write a class that uses the command window to display the following statement about comments:

Program comments are nonexecuting statements you add to a file for the purpose of documentation.

Also include the same statement in three different comments in the class; each comment should use one of the three different methods of including comments in a Java class.

+1
Answers (1)
  1. 13 July, 09:35
    0
    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!
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Open Comments. java and write a class that uses the command window to display the following statement about comments: Program comments are ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers