Skip to main content
PProfileMatch
← Path

Java · Java Variables and Data Types

0 XP
  1. 1 current stop: learning
  2. 2 upcoming
  3. 3 upcoming
  4. 4 upcoming
  5. 5 upcoming

Finish after stop 5

Stop 1 of 5 · Park gate: two twins waiting

Trick to keep in mind+3 XP

Twins look alike (equals) but are not the same person (==).

For objects, == asks whether two variables point at one and the same object. .equals() asks whether the contents match. Two Strings built separately can read identically while sitting in different places in memory. For primitives such as int, == just compares the values.

Read it once, then a question tests whether the trick stuck.