In Java, there are two types of comments: single-line and multi-line comments.
- Single-line comments begin with two forward slashes (//) and apply only to that specific line.
- Multiline comments start with /* and end with */. These can span multiple lines.
This format allows developers to comment out blocks of code or provide lengthy documentation within the code.
Option (B) is the correct method for writing multiline comments in Java.
Options (C) and (D) use syntax not valid in Java — the hash symbol (#) is not recognized for commenting in Java.
Option (A) is only valid for single-line comments, not multiline ones.