Skip to main content
Commonmark migration
Source Link

#Java

Java

Probably too obvious.

public static void main(String[] varargs) throws Exception{ char a, b = (char)Integer.parseInt("000d",16); // Chars have \u000d as value, so they're equal if(a == b){ throw new Exception("This should be thrown"); } } 

What?

Throws a syntax error after \u000d. \u000d is the unicode for a new line. Even though it is commented out, the Java compiler treats what is after this as code since it isn't commented out anymore.

#Java

Probably too obvious.

public static void main(String[] varargs) throws Exception{ char a, b = (char)Integer.parseInt("000d",16); // Chars have \u000d as value, so they're equal if(a == b){ throw new Exception("This should be thrown"); } } 

What?

Throws a syntax error after \u000d. \u000d is the unicode for a new line. Even though it is commented out, the Java compiler treats what is after this as code since it isn't commented out anymore.

Java

Probably too obvious.

public static void main(String[] varargs) throws Exception{ char a, b = (char)Integer.parseInt("000d",16); // Chars have \u000d as value, so they're equal if(a == b){ throw new Exception("This should be thrown"); } } 

What?

Throws a syntax error after \u000d. \u000d is the unicode for a new line. Even though it is commented out, the Java compiler treats what is after this as code since it isn't commented out anymore.

added 12 characters in body
Source Link

#Java

Probably too obvious.

public static void main(String[] varargs) throws Exception{ char a, b = (char)Integer.parseInt("000d",16); // Chars have \u000d as value, so they're equal if(a == b){ throw new Exception("This should be thrown"); } } 

What?

Throws a syntax error after \u000d. \u000d is the unicode for a new line. Even though it is commented out, the Java compiler treats what is after this as code since it isn't commented out anymore.

Probably too obvious.

public static void main(String[] varargs) throws Exception{ char a, b = (char)Integer.parseInt("000d",16); // Chars have \u000d as value, so they're equal if(a == b){ throw new Exception("This should be thrown"); } } 

What?

Throws a syntax error after \u000d. \u000d is the unicode for a new line. Even though it is commented out, the Java compiler treats what is after this as code since it isn't commented out anymore.

#Java

Probably too obvious.

public static void main(String[] varargs) throws Exception{ char a, b = (char)Integer.parseInt("000d",16); // Chars have \u000d as value, so they're equal if(a == b){ throw new Exception("This should be thrown"); } } 

What?

Throws a syntax error after \u000d. \u000d is the unicode for a new line. Even though it is commented out, the Java compiler treats what is after this as code since it isn't commented out anymore.

Source Link

Probably too obvious.

public static void main(String[] varargs) throws Exception{ char a, b = (char)Integer.parseInt("000d",16); // Chars have \u000d as value, so they're equal if(a == b){ throw new Exception("This should be thrown"); } } 

What?

Throws a syntax error after \u000d. \u000d is the unicode for a new line. Even though it is commented out, the Java compiler treats what is after this as code since it isn't commented out anymore.