We know “Comments do not Execute” . Below is the code which shows “The comments that execute” in java.
public class Testing
{
public static void main(String[] args)
{
// the line below this gives an output
// \u000d System.out.println("comment executed");
}
}
Output:
comment executed
Explanation:
The reason for the comments to execute is that the Java compiler parses the unicode character \u000d as a new line, ending the comment and beginning an instance initializer therefore System.out.println("comment executed") is on line that is not commented the unicode character \u000d put it on new line and gets transformed into:
public class Testing
{
public static void main(String[] args)
{
// the line below this gives an output
// \u000d
System.out.println("comment executed");
}
}
0 Comment(s)