Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Review Java OO principles, specifically the idea that all Java classes are subclasses of the Object class , and thus must have all the methods

  1. Review Java OO principles, specifically the idea that all Java classes are subclasses of the Object class, and thus must have all the methods of the Object class even if they don't show up in the Java code for the class. See S&W page 101. You can see the Object class API (and any other standard class) by following the link "JDK API" on the class web page under Resources. Choose Object in the pane titled All Classes, and the API will be displayed on the right.

    1. What are the four most important Object methods? (Hint: their names start with e, h, g, and t). Because all objects have these methods, we can use HashSet to contain almost any set of objects (but we'll stick to sets of similar-type objects in our work).
    2. Show equals in use by writing one if () that checks whether s String s is equal to a String t, character by character. Explain what this comparison is doing if s = abc and t = abx. Compare this to what happens in if (s == t).
    3. Find the hashCode and toString values for String s = xyz. Also for the Integer of value 8.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And SQL For DB2

Authors: James Cooper

1st Edition

1583473572, 978-1583473573

More Books

Students also viewed these Databases questions