What is the difference between the '==' operator and the '.equals()' method in Java?
Ans. The '==' operator checks reference equality, while '.equals()' checks value equality in Java.
'==' compares memory addresses (references) of objects.
Example: String a = new String("test"); String b = new String("test"); a == b returns false.
'.equals()' compares the actual content of objects.
Example: a.equals(b) returns true because the content is the same.