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

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
ETS User

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

Post 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.

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

Thank you for your suggestion. This has now been added.

-Paul.

DusitnR

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

Post by DusitnR »

Primitive is misspelled. I only say because I like this software and want it to do well. :)

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.

baxhuli
Posts: 5
Joined: Wed Mar 27, 2013 11:57 am
Contact:

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

Post by baxhuli »

return value..
what is the type of value to be returned? can you provide some more details?
thank you

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.

jmrego
Posts: 8
Joined: Wed Dec 10, 2014 6:05 am
Contact:

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

Post by jmrego »

Doesn't "equals method can be overrided" aplly in this case?

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

Not sure what you mean. Primitive wrapper classes already have their equals method defined. How will you change them?

Denyo1986
Posts: 38
Joined: Thu Jan 07, 2021 2:47 am
Contact:

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

Post 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.

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests