Results 1 to 3 of 3
Thread: equals(object obj)
- 09-06-2010, 10:57 PM #1
Member
- Join Date
- Sep 2010
- Posts
- 11
- Rep Power
- 0
equals(object obj)
Hi there.
I don't understand the following Boolean:(plz some one explain it to me what it does.What is exactly onject and what does equals((point3)p ) do?)
-------------------------------------------------------------
public class Point3 extends Point2 {
private int z;
...
public boolean equals(Object p) { // overriding definition
if (p instanceof Point3) return equals((Point3)p);
return super.equals();
}
public boolean equals(Point2 p) { // overriding definition
if (p instanceof Point3) return equals((Point3)p);
return super.equals();
}
- 09-07-2010, 01:51 AM #2
Casts p to type in () and calls the equals method with that type as an argumentequals((point3)p )
What happens when you execute the code? Add some print statements to show how the compiler matched the code to the method.
- 09-07-2010, 07:08 AM #3
Member
- Join Date
- Sep 2010
- Posts
- 11
- Rep Power
- 0
Similar Threads
-
== and equals()
By arefeh in forum New To JavaReplies: 13Last Post: 01-05-2010, 04:56 PM -
== is same as .equals()??
By DrMath in forum New To JavaReplies: 1Last Post: 09-30-2009, 04:57 AM -
Object class's equals() method behavior????
By skyineyes in forum New To JavaReplies: 4Last Post: 07-19-2008, 11:58 PM -
[SOLVED] If a object equals another object, do they contain the same data?
By bobleny in forum New To JavaReplies: 1Last Post: 04-17-2008, 10:10 PM -
name clash: equals(E) in and equals(java.lang.Object)
By AdRock in forum New To JavaReplies: 0Last Post: 01-25-2008, 11:13 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks