{
  "id": "programming.objects.equality-compares-contents",
  "uri": "https://open-misconceptions.github.io/miscon-data/m/programming.objects.equality-compares-contents",
  "uuid": "23722159-9645-4246-a122-1d6ea3fd6ddf",
  "version": "0.1.1",
  "status": "draft",
  "trust": "low",
  "title": "== compares the contents of objects",
  "statement": "Comparing two object variables with == compares what is inside the objects, so two objects with the same field values are equal.",
  "kind": "overgeneralization",
  "domain": "programming.objects",
  "about": [
    {
      "scheme": "Miscon",
      "uri": "https://open-misconceptions.github.io/miscon-data/c/programming.objects.identity-vs-equality"
    }
  ],
  "level_band": [
    "secondary",
    "undergraduate"
  ],
  "locale": "en",
  "evidence_patterns": [
    {
      "item_shape": "predict == on two distinct objects with equal contents",
      "signature": "predicts true",
      "example": {
        "item": "String a = new String(\"hi\");\nString b = new String(\"hi\");\nSystem.out.println(a == b);",
        "expected": "false",
        "response": "true"
      }
    }
  ],
  "discriminators": {
    "vs_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": [
      {
        "external": "https://open-misconceptions.github.io/miscon-data/c/programming.objects.identity-vs-equality",
        "label": "== on references compares identity, not contents"
      }
    ],
    "resolved_by": [
      {
        "external": "https://open-misconceptions.github.io/miscon-data/c/programming.objects.identity-vs-equality",
        "label": "== on references compares identity, not contents"
      },
      {
        "external": "https://open-misconceptions.github.io/miscon-data/c/programming.objects.reference",
        "label": "An object variable holds a reference; assignment copies the reference"
      }
    ],
    "confusable_with": [
      "programming.objects.variables-hold-objects"
    ]
  },
  "alignments": [
    {
      "scheme": "progmiscon",
      "code": "Java/EqualityOperatorComparesObjectsValues",
      "uri": "https://progmiscon.org/misconceptions/Java/EqualityOperatorComparesObjectsValues",
      "relation": "close-match"
    }
  ],
  "provenance": {
    "sources": [
      {
        "type": "inventory",
        "citation": "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",
        "url": "https://progmiscon.org/",
        "note": "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."
      },
      {
        "type": "paper",
        "citation": "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"
      }
    ],
    "origin": "llm-drafted",
    "notes": "Drafted from the cited literature for the Open Misconceptions seed pack; statement, examples and discriminators are original text. Awaiting maintainer review."
  },
  "history": {
    "changelog": [
      {
        "version": "0.1.1",
        "date": "2026-09-05",
        "change": "Schema 0.2 migration: about/alignments carry a free-string scheme (corestandards.org URLs relabelled CCSS where present); trust computed from reviews[] (none yet, so low); no change to the statement or evidence."
      }
    ]
  },
  "license": "CC-BY-4.0"
}
