Completion requirements
This chapter discusses naming and coding conventions as well as reserved words in Java. When you go through this chapter, you'll get some hands-on experience with writing in Java.
16. Many Comments
Answer:
No. The compiler ignores comments when creating the bytecodes.
Comments are just for human readers of the source program.
Many Comments
public class Haiku { public static void main ( String[] args ) { System.out.println("On a withered branch" ); // Write first line of the poem System.out.println("A crow has just alighted:"); // Write 2nd line of the poem System.out.println("Nightfall in autumn."); // Write 3rd line of the poem } } |
Comments can be placed after a program statement to explain what it does, as here.
The //
and everything after it on that line is ignored by the compiler. The program statement in the start of the line is not affected by the comment.
Question 16:
Would you ever want to write an entire paragraph of comments?