|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
Advanced Placement Computer Science
Standard Disclaimer: This isn't the
official javadoc version of java.lang.Object
,
it's the AP-friendly version.
The root of the Java class hierarchy.
Constructor Summary | |
Object()
|
Method Summary | |
boolean |
equals(Object other)
Determines if this object is "equal" to another object. |
int |
hashCode()
|
String |
toString()
|
Constructor Detail |
public Object()
Method Detail |
public boolean equals(Object other)
In general, objects should be instances of the same class
with the same guts to be considered equal. For example,
the code below only prints same value since
s
and t
are different strings though
they have the same value: "hello".
String s = new String("hello"); String t = new String("hello"); if (s.equals(t)) System.out.println("same value"); if (s == t) System.out.println("same string");
is
- the other Object to which this one is comparedother
public String toString()
public int hashCode()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |