Why is the print command executed although it is a comment? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why is the print command executed although it is a comment?

public class Comment { public static void main() { // \u000d System.out.println("comment executed"); } }

11th Oct 2017, 11:09 AM
Vedansh Agrawal
Vedansh Agrawal - avatar
3 Answers
+ 4
Because \u000d is a unicode escape that is a carriage return, it is processed before compilation so it's Like there are 2 rows, one with just // and below the println, as it is not commented, it's executed
11th Oct 2017, 8:54 PM
dadotc
+ 3
try to remove \u000d
11th Oct 2017, 2:22 PM
Arl Kheem Rey B. Galario
Arl Kheem Rey B. Galario - avatar
- 1
What is //\u000d mean?
13th Oct 2017, 6:06 PM
Crystal Gem McKracken
Crystal Gem McKracken - avatar