Page 1 of 1

About Question enthuware.ocpjp.v7.2.1732 :

Posted: Sun Oct 19, 2014 11:53 am
by logtwo
Hi,
I'm a bit confused about line being 2 an error due to method clone() being declared final in Enum class, as solution says.

Code: Select all

 public enum EnumB{ B, BB, BBB;      
public Object clone(Object o){ return B; } //2    
}
If I'm not wrong, line marked as //2 is not an override of Object.clone() method, but rather an overload of it, since parameters are different (one Object vs no parameters at all in Object's method).

Is the option 2 actually correct despite of this? If it is so, why?

Thank you

Re: About Question enthuware.ocpjp.v7.2.1732 :

Posted: Sun Oct 19, 2014 7:53 pm
by admin
You are right. The given clone method should not have any parameter. Fixed.
thank you for your feedback!
Paul.

Re: About Question enthuware.ocpjp.v7.2.1732 :

Posted: Thu Oct 30, 2014 7:47 am
by Veritas
looks like a typo in the explanation
6. (...) with an enum constant and returns that constant if successful (...)

Re: About Question enthuware.ocpjp.v7.2.1732 :

Posted: Fri Oct 31, 2014 6:56 am
by admin
You are right. Fixed.
thank you for your feedback!