== will check if two references point to the same object. For instance, if you take a third variable and assign the value of d1 to it (Dog d3 = d1) , then d1 == d3.
equals will use some developer defined comparison. For Strings it is whether or not both Strings have the exact same characters, for Integers it is whether they represent the same int value, but this comparison can easily include many many fields.
However, you as a developer will have to override equals yourself. If you do not, you will inherit the implementation of your parent class. For Dog, that is Object, and Object simply uses == in its check:
Please read the API of Object.equals and Object.hashCode for the exact rules. [ July 27, 2008: Message edited by: Rob Prime ]
Questions on equals() versus == get asked a lot. You can take a look at this recent thread for a detailed discussion on the subject. And if you search the forum, you'll find a number of other discussions on it.
all the primitive type wrapper classes override the Object.equals() method to compare the value of the objects; the default Object.equals() checks if the variables reference the same object. equals(Object anObject)Compares this string to the specified object
That message means that the compiler was reading your file and was expecting more. It's usually a sign of unbalanced braces. Make sure all your opening braces are closed.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.