Hiya folks, well, just like the greatest rock and roll band in the world, ever - The WHO, i'm back, after an almighty almost 3 year absence. Close family bereavments, job changes and site secondments aside, i've decided to wind up the old Java elastic band, and dive back into it. Are the Java tutorials still being done [think i completed the 1 to 99 in words exercise].
I've got back into the books, and am currently on a chapter called "A closer look at classes and methods".
The topic of "Using Objects as Parameters" has just cropped up.
The code i'm slightly confused on, is the following:-
I basically understand what the program is doing, except for the lines
Could someone explain to me what is happening in these 2 lines?
Thanks in advance
John Bonham was stronger, but Keith Moon was faster.
The equals(Object) method is defined in the Object class, which is the ultimate base class for all other classes. The class Test overloads equals() so for cases where it's called with a Test object as an argument. equals() returns a boolean value, so those two System.out.println() lines will print the string and either "true" or "false". e.g. "obj1 == obj2: false".
Did that answer your question? You understand what the constructor and equals() method in the Test class are doing, right?