CSc 305 Talk Summary Template

Student ____Stephanie_Long_____
Email    __stephanielong8@comcast.net____
Topic _Java_Object_Model(7.1-7.4)_and_Overrriding_Methods_

List the key points in your talk.

  • Key point #1:Java Type System:
  • discuss type definition, class types, array types, value of types includes examples and figure
  • Key point #2: subtype relationship discuss list of items which if satisfied means a class is a sub type of another
  • discuss super class vs. sub class includes example
  • Key point #3: Wrapper Classes
  • Key point #4: Equality Testing
  • discuss .equals() method vs '==' technical requirements includes example
  • Key point #5: Enumerated types
  • discuss; includes example
  • Key point #6: Type Inquiry
  • discuss getting type name, testing type with instance of, type inquiry with arrays
  • Key point #7: Object Class
  • discuss class and methods discuss toString method
  • Key point #8: Hashing
  • discuss strategy and related classes and defaul implementation includes example code
  • Key point #9: Shallow copy vs. Deep Copy
  • discuss shallow copy and deep copy definiation
  • Key point #10: Overriding Object Methods
  • discuss ability and solutions discuss methods which cannot be overridden discuss methods which must be overridden
    Include any diagrams or illustrations you present


    Deep Copy Pic


    Shallow Copy Pic





    1. PowerPoint Presentation

    1. Class Exercise

    1. Class Exercise Solution


    Give two short exam questions (and solutions) about your topic.
    • Question #1:
    • What is the difference between using the .equals() method to check equality versus using '=='? Name and explain two of the four technical requirement the Java Language Specification imposes on the equals method.
    • Solution #1:
    • The x.equals(y) method is used to test whether x and y are references to two objects, that may be distinct, have the "equal" contents. The '==' operator (x == y) tests whether x and y are two references to the same object. The four requirements are: 1)it is reflexive - for any reference value x, x.equals(x) should return true, 2)it is symmetric - for any reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true, 3)it is transitive - for any reference values x, y and z, if x.equals(y) return true and y.equals(z) returns true, then x.equals(z) should return true, 4)For any non-null reference value x, x.equals(null) should return false.
    • Question #2:
    • What is the difference between a shallow copy and a deep copy?
    • Solution #2:
    • A shallow copy makes a new object of the same type as the original and copies the values of all the fields. A shallow copy copies the object itself, but not any of the other objects that the first object refers to. The copy will refer to the same objects as the original object. A deep copy copies the object and all objects it refer to, and any objects those might refer to and so on.

    • Reference #1: Horstmann, Cay. Object-Oriented Design & Patterns. 2nd ed. Danvers, MA: John Wiley & Sons, Inc., 2006. 262-284.