What is the value of (list("a").equals(list("a")))

  • A: true
  • B: false
  • C: null
  • D: error
  • E: could be true or false

    Answer: A

    In general, .equals() compares the values of two reference types (as opposed to ==, which compares locations, or exact identity). Since these two objects have equal values, .equals() returns true.

    Contents    Page-10    Prev    Next    Page+10    Index