How it is possible in Java for false to equal true
boolean, java
Solution
Well, I'll be generous and assume that this question was asked out of innocence.
The Java compiler parses Unicode escape sequences very early in the process. In particular, it does this before stripping comments or checking for syntax. Since `\u000a` is a newline, `\u007d` is the character "}" and `\u007b` is the character "{", the parser is actually parsing this program:
public class Wow{
public static void main(String[] args) {
if ( false == true ){ //
}{
System.out.println("How is it possible!!!");
}
}
}
This program will always print the "impossible" output.
Problem
In this program, how can false be equal to true: ``` public class Wow { public static void main(String[] args) { if ( false == true ){ // \u000a\u007d\u007b System.out.println("How is it possible!!!"); } } } ```