Explore Library
Code QuizBeginner

Comparison vs Assignment

Find why this equality check won't compile.

Codejava
public class Compare {
    public static void main(String[] args) {
        int x = 5;
        if (x = 5) {
            System.out.println("equal");
        }
    }
}

What is the bug in this code?