Hi,
I'm starting to study for my
SCJP and i'm right at the begining, i'm reading SCJP for
java 6 by Kathy and Bert.
Now my doubt, on page 49 of the book we learning about Abstract Methods:
abstract Car ->class
startEngine( )
abstract goForward( )
abstract reverse( )
stop( )
abstract turn(int whichWay)
then we have two implementations which only one makes me have doubts:
abstract SUV ->class
enable4wd( )
goForward( )
reverse( )
abstract goOffRoad( )
//turn( )not implemented
AcmeRover -> Class
enable4wd( )//optional
goOffRoad( )//Required
turn(int whichWay)//Required
So i have one totally abstract class
abstract Car no method is implemented then we implment anothe Abstract class
abstract SUV so far so good since it's also abstract so no need to implement nothing.
But then we have class
AcmeRover first concrete classe so it has to implement all the abstract members that aren't implemented till then, so for me it would need to implement:
startEngine( ) -> from Car class
abstract goForward( ) -> from Car class
abstract reverse( ) -> from Car class
stop( ) -> from Car class
abstract turn(int whichWay) -> from Car class
but also:
enable4wd( )-> from SUV class
goForward( )-> from SUV class
reverse( )-> from SUV class
abstract goOffRoad( )-> from SUV class
turn( )-> from SUV class
why? because iven if it's not explicit that all methods are abstracted, they are declare and end with () so not implemented which i think is implicit, also since the package is not stated i assume they are on the same so even with Default access the all methods are visible to the concrete class.