miscon:programming.objects.equality-compares-contents · draft · trust low · v0.1.1 · kind overgeneralization

== compares the contents of objects

Comparing two object variables with == compares what is inside the objects, so two objects with the same field values are equal.

Stable URI
https://open-misconceptions.github.io/miscon-data/m/programming.objects.equality-compares-contents
UUID
23722159-9645-4246-a122-1d6ea3fd6ddf
Domain
programming.objects
Level band
secondary, undergraduate
Locale
en
About
https://open-misconceptions.github.io/miscon-data/c/programming.objects.identity-vs-equality (Miscon)

Evidence patterns

Pattern 0: predict == on two distinct objects with equal contents

predicts true

ItemString a = new String("hi"); String b = new String("hi"); System.out.println(a == b);
Expectedfalse
Responsetrue

Discriminators

vs a slip. Consistent across items and the learner sees no difference between == and equals. A slip is choosing the wrong operator once while knowing the difference.

vs programming.objects.variables-hold-objects. Learners with no reference concept also predict true, but for a different reason (they see no identity to compare). Ask what == compares.

Relations

conflicts_with
== on references compares identity, not contents (external)
resolved_by
== on references compares identity, not contents (external)
An object variable holds a reference; assignment copies the reference (external)
confusable_with
programming.objects.variables-hold-objects

Alignments

Provenance

Origin: llm-drafted

  1. Chiodini, L., Moreno Santos, I., Gallidabino, A., Tafliovich, A., Santos, A. L., & Hauswirth, M. (2021). A curated inventory of programming language misconceptions. In Proceedings of the 26th ACM Conference on Innovation and Technology in Computer Science Education (ITiCSE '21), 380-386. doi:10.1145/3430665.3456343
    Inventory consulted for the misconception name and scope only; progmiscon publishes no licence for its text, so Open Misconceptions' statements and examples are written independently.
  2. Holland, S., Griffiths, R., & Woodman, M. (1997). Avoiding object misconceptions. In Proceedings of the 28th SIGCSE Technical Symposium on Computer Science Education (SIGCSE '97), 131-134. doi:10.1145/268084.268132

Drafted from the cited literature for the Open Misconceptions seed pack; statement, examples and discriminators are original text. Awaiting maintainer review.

Review status

Status draft, trust low (computed from the reviews below against the reviewer registry).

No reviews yet.

Formats

Cite

miscon:programming.objects.equality-compares-contents
https://open-misconceptions.github.io/miscon-data/m/programming.objects.equality-compares-contents