Which of the following are valid comments?
(i) /* comment */
(ii) /* comment
(iii) // comment
(iv) */ comment */
1. (i) & (iii)
2. (i) & (ii)
3. All of the above
4. None of the above
Answers
Answered by
0
Answer:
1. (i) & (iii)
This is the correct answer.
Explanation:
There are mainly two types of comments in Java:
1. Single Line Comment: Single line comments starts with two forward slashes (//). Any text in front of // is not executed by Java.
Example: public static void main( ){ //This is a single line comment
2. Multi Line Comment: Multi-line comments are placed between /* and */. Any text between /* and */ is not executed by Java.
Example:
public static void main( ){
/*
This is a
multi line
comment
*/
Similar questions
English,
3 hours ago
Computer Science,
6 hours ago
English,
6 hours ago
Physics,
8 months ago
Physics,
8 months ago