Question 1 of 5
Name the three Java comment forms and give one purpose for each.
(a) // (b) /* */ (c) /** */
Responses receive AI feedback against a rubric after submission. Scores are practice estimates.
Name the three Java comment forms and give one purpose for each.
(a) // (b) /* */ (c) /** */
A mixer program currently contains:
int speed = 2;
speed *= 3;
System.out.print(speed);
(a) Show how to comment out only the speed *= 3; line using // so the printed value becomes 2. (b) Explain why the comment is not displayed. (c) Explain one reason a programmer comments out code during testing.
Trace this bakery code and state the displayed text.
int eggs = 6;
/* eggs -= 2;
eggs += 5; */
eggs += 1;
System.out.print(eggs);
Then explain how a block comment differs from a // comment that appears on the eggs += 1; line.
A student writes this header above a method:
/**
* Returns the number of cooled loaves on the rack.
*/
(a) Identify the comment form. (b) Explain its intended audience and purpose. (c) Explain whether this comment assigns any variable by itself.
A classmate claims any text that looks like Java inside a comment still runs.
int oven = 1;
// oven += 4;
oven += 2;
System.out.print("/* hot */");
(a) State the value of oven after this code. (b) State the displayed text. (c) Correct the classmate using both the line comment and the string literal.