Page 1 of 1

About Question enthuware.ocajp.i.v7.2.994 :

Posted: Tue Aug 28, 2012 4:22 am
by ETS User
Suggestion: It might be a good idea to post the content of the method WrapperType.equals(Object obj) to the explanation.
For example, equals() inside the class Interger is:

public boolean equals(Object obj) {
if (obj instanceof Integer) {
return value == ((Integer)obj).intValue();
}
return false;
}

This might make it easier to understand.

Re: About Question enthuware.ocajp.i.v7.2.994 :

Posted: Tue Aug 28, 2012 6:41 am
by admin
Thank you for your suggestion. This has now been added.

-Paul.

Re: About Question enthuware.ocajp.i.v7.2.994 :

Posted: Fri Sep 14, 2012 11:34 am
by DusitnR
Primitive is misspelled. I only say because I like this software and want it to do well. :)

Re: About Question enthuware.ocajp.i.v7.2.994 :

Posted: Sun Sep 16, 2012 6:01 am
by admin
DusitnR wrote:Primitive is misspelled. I only say because I like this software and want it to do well. :)
Your feedback is very much appreciated. This has now been fixed.
-Paul.

Re: About Question enthuware.ocajp.i.v7.2.994 :

Posted: Mon Apr 01, 2013 5:37 am
by baxhuli
return value..
what is the type of value to be returned? can you provide some more details?
thank you

Re: About Question enthuware.ocajp.i.v7.2.994 :

Posted: Mon Apr 01, 2013 5:58 am
by admin
The type of return value is determined by the method declaration. If you specify boolean as the return type of the method, you have to return a boolean.

HTH,
Paul.

Re: About Question enthuware.ocajp.i.v7.2.994 :

Posted: Mon Jan 19, 2015 12:51 pm
by jmrego
Doesn't "equals method can be overrided" aplly in this case?

Re: About Question enthuware.ocajp.i.v7.2.994 :

Posted: Mon Jan 19, 2015 8:05 pm
by admin
Not sure what you mean. Primitive wrapper classes already have their equals method defined. How will you change them?

Re: About Question enthuware.ocajp.i.v7.2.994 :

Posted: Sat Jan 09, 2021 9:32 am
by Denyo1986
Maybe I confuse something here but I find the way the question is written ambiguous.
It is not clear to me if "refer to instances of primitive wrapper classes" means:
a) there is one object of type a, one object of type b, etc.
or
b) all objects of type a, i.e. different objects of that class

I understood it as b) as which means that a.equals(a) would only be true if the same objects are referred to. I could, however, run equals on two different objects of the same class and would yield a false.

I would suggest to re-phrase the question saying "each refer to one particular instance of primitive wrapper classes". In that case it is clear.

Re: About Question enthuware.ocajp.i.v7.2.994 :

Posted: Sat Jan 09, 2021 12:03 pm
by admin
There are different primitive wrapper classes - Byte, Short, Integer, etc.
The question quite clearly says that a , b, and c, could refer to instances of any of these classes. For eg. a might be referring to an Integer object, b might refer to a Short object and so on. a b and c are variables. Not objects.

Not sure what you find ambiguous in it.