Forums Register Login

How many Object classes overridded the equals() method?

+Pie Number of slices to send: Send
How many Object classes overridded the equals() method ?
If possible please tell me what are they .
Thank you .
+Pie Number of slices to send: Send
+Pie Number of slices to send: Send
there is only one Object class ...
+Pie Number of slices to send: Send
I mean some of the subclasses of Object .
+Pie Number of slices to send: Send
A book saied as fallows:

The equals() method is a special method contained in the Object class that compares properties between two objects. The properties that the method tests are determined by the type of object being tested. This is in contrast to the == operator, which tests whether two reference variables are the same, as described earlier in the chapter.

The equals() method is typically overridden in a subclass. When this method is not overridden, it is identical to the == operator (it compares two reference variables). For the Java exam you will need to know the behavior of String, Boolean, and Object types.


I just want to know how many these Subclasses are .
+Pie Number of slices to send: Send
Then you will have to count them. Is there any particular reason you need to know this?
+Pie Number of slices to send: Send
Well I am preparing for the SCJP 1.4 exam.
Do I need to know this?
+Pie Number of slices to send: Send
 

Originally posted by Ths SG:
Well I am preparing for the SCJP 1.4 exam.
Do I need to know this?


No you don't need to know this. You *do* need to know how and where to find out whether or not a class does override the equals() method. And while you're reading the appropriate docs check if that class overrides the hasCode() method also, if not, start revolting and sending in bug reports.
kind regards
ps. My guess is that *nobody* knows from the top of his/her head how many classes override these methods ...
+Pie Number of slices to send: Send
It's good to know for the exam that StringBuffer does not override Object.equals(), but String does.
[ January 28, 2003: Message edited by: Barry Gaunt ]
+Pie Number of slices to send: Send
It would probably be easier to count the classes that DON'T override the equals method. However, such details aren't necessary for the exam. As stated, you need to know when to use the equals() method and how to find out if a class overrides this method.
[ January 28, 2003: Message edited by: Layne Lund ]
+Pie Number of slices to send: Send
Thanks Ilja Preuss,your page is great
and thanks everyone,your suggestions are very helpful.
You showed up just in time for the waffles! And this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1308 times.
Similar Threads
Float Confusion
Objects equal method
String and StringBuffer class
.equals() question
equals()
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 08:47:35.