Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help on my Java exercise. I actually don\'t understand the question so i

ID: 3781282 • Letter: I

Question

I need help on my Java exercise. I actually don't understand the question so i can't really do anything on jGrasp. Can someone help me? Thank you!

10. Write, compile, and test 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. Save the class as comments.java.

Explanation / Answer

The question is how you can write a comment in Java class program. There are three ways as follows:

/* text */ ==>> The compiler ignores everything from /* to */.
// text ==>> The compiler ignores everything from // to the end of the line.
/** documentation */ ==>> This indicates a documentation comment (doc comment, for short). The compiler ignores this kind of comment, just like it ignores comments that use /* and */. The JDK javadoc tool uses doc comments when preparing automatically generated documentation.

Eg. usage:

/**
Program comments are nonexecuting statements you add a file for the purpose of documentation.
*/
class Comments {
public static void main(String[] args) {
  
   /* Program comments are nonexecuting statements you add a file for the purpose of documentation. */
   System.out.println("Hello World!");
   System.out.println("Hello World!");  // Program comments are nonexecuting statements you add a file for the purpose of documentation.
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote