Language syntax
Reference equality operators == and !=
When both operands are comparable reference types, identity equality checks whether they point to the same object or both are null. It does not call equals. Syntax shows alternative expressions.
Formal Syntax & Structure
java syntaxjava
a == b; a != bWorking Example
Example Snippetjava
public class Main { public static void main(String[] args) { String a = new String("North"); String b = a; System.out.println(a == b); System.out.println(a == new String("North")); }}