Page 1 of 1

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

Posted: Sun Nov 04, 2012 10:01 am
by gliesian
As they are listed, all of the following classes have a warning in NetBeans:

ImaginaryNumber is not abstract and does not override abstract method doubleValue() in Number:

Code: Select all

public class ImaginaryNumber extends Number { }
No suitable constructor found for boolean:

Code: Select all

public class ThreeWayBoolean extends Boolean { }
System has private access in System:

Code: Select all

public class NewSystem extends System { }
Cannot inherit from final String:

Code: Select all

public class ReverseString extends String { }
Thanks,
Robert

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

Posted: Sun Nov 04, 2012 11:16 am
by admin
I am not sure what is your point here. These are not the right options.

HTH,
Paul.

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

Posted: Sun Nov 04, 2012 11:18 am
by admin
BTW, as a general rule, what netbeans shows in the IDE is not as important as what the compiler shows when you try to compile a piece of code. (From the exam perspective)

HTH,
Paul.

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

Posted: Sat Mar 08, 2014 1:42 pm
by boonnick
I tried to compile

public class ImaginaryNumber extends Number { }

on the command line.

C:\Users\Nick\Desktop>javac ImaginaryNumber.java
ImaginaryNumber.java:1: error: ImaginaryNumber is not abstract and does not over
ride abstract method doubleValue() in Number
public class ImaginaryNumber extends Number { }
^
1 error

C:\Users\Nick\Desktop>

If it doesn't compile, is it a valid class?

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

Posted: Sat Mar 08, 2014 9:33 pm
by admin
You are right. The code has been updated to indicate that it contains implementation for abstract methods of the base class.
thank you for your feedback!