Unicode decoding side effect. Application throws exception when a comment is removed.

Transcribed from the original LinkedIn image post.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
/*
/u000d in unicode is new line so when unicode decoding happens
the code is in new line and becomes valid java code.

Unicode decoding is a process for decoding unicode characters
then converting it to ASCII

while java code compiles it, first unicode decoding happens then
lexical translation
*/
class Day17 {
    public static void main(String[] args) {
        int number = 0;
        // Please don't remove below comment. Program will crash
        // \u000d number = 10;
        System.out.println(10 / number);
    }
}

The original LinkedIn graphic is preserved below.

Day 17 LinkedIn post