jQuery in Action, 2nd edition
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes is-a relationship Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "is-a relationship" Watch "is-a relationship" New topic
Author

is-a relationship

Sank Shah
Greenhorn

Joined: Sep 22, 2009
Posts: 4
Please help me with the following:
In the Master Exam of SCJP 6 book the following option was considered true:

"is-a relationships always require at least two class types"

My understanding is:
A class (say C) implementing an interface (say I) will also follow "C is-a I" relation. Here I is not a class but an interface, so above option should not be considered true as "is-a relationship" can be fulfilled using a class & an interface.

Is my understanding of above option incorrect or is the answer incorrect?
Thanking you in advance.
Brett Maclean
Greenhorn

Joined: May 01, 2009
Posts: 22
At the risk of being controversial I'd say that an interface defines behaviour whereas a class models a thing in the problem domain. The thing might be a generic and non-instantiable and hence an abstract class or it might have concrete objects but it's a thing nonetheless.

An interface defines what sort of operations the object performs e.g. move(), getCustomers(), drive() and hence is more about the object's capabilities (i.e. what it does) than its essence or what it is.

So I'd have to agree with them that an is-a relationship is really between two classes, but qualify that with the distinction is getting pretty philosophical / pernickety. But I guess that's object modelling in a nutshell ;-)


http://www.ontruenorth.com
Follow us on Twitter: http://twitter.com/truenorth_buzz
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6603
    
    1

A class (say C) implementing an interface (say I) will also follow "C is-a I" relation. Here I is not a class but an interface, so above option should not be considered true as "is-a relationship" can be fulfilled using a class & an interface.


You are nitpicking but technically correct. Perhaps it is in the errata ? Did you check there ?


SCJP 6 articles - SCJP 5/6 mock exams - SCJP Mocks - SCJP 5 Mock exam (Word document ) - SCJP 5 Mock exam in Java.Inquisition format
Nitish Bangera
Ranch Hand

Joined: Jul 15, 2009
Posts: 536
Basically interfaces are called 100% abstract classes hence the answer is true......better than the other answers given i suppose. Well the other aspect of this is interface and interface or interfaces too and class and many interfaces. But to be exact only 2 classes can have is-a and not more than that.


[ SCJP 6.0 - 90% ] , JSP, Servlets and Learning EJB.
Try out the programs using a TextEditor. Textpad - Java 6 api
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: is-a relationship
 
Similar Threads
Need your help!
About IS-A relationships needing two classes
Enthuware standard tests doubts
"Is-a" relationship exam question
isn't interface support inheritance