Multiple choice technology

What output is displayed as the result of executing the following statement? System.out.println("// Looks like a comment.");

  1. 1.// Looks like a comment

  2. 2.The statement results in a compilation error

  3. 3.Looks like a comment

  4. 4.No output is displayed

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In Java, text inside double quotes is always a String literal, regardless of its content. The compiler does not treat // inside quotes as comments. The statement prints the literal string // Looks like a comment. There is no compilation error because the syntax is valid.