It's not a secret anymore!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes IS-A confusion with practise exam question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "IS-A confusion with practise exam question" Watch "IS-A confusion with practise exam question" New topic
Author

IS-A confusion with practise exam question

Stephen Pengilley
Greenhorn

Joined: Apr 06, 2013
Posts: 3
Hi all,

One of the questions in the practise program for exams asks whether the following statement is true

'is-a relationships always require at least two class types.'

I didn't think this was true but apparently I am wrong. The practise exam says that it is true!

However,

interface foo {}

class bar implements foo {}

uses inheritance and passes is-a. But there is only one class type isn't there?

Would appreciate an explanation so I know which is true.

Regards
Stephen
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2505
    
    8

What's your definition of a "class type"? Is an interface a class type?

So whether you say "class A extends B {}" or "class A implements B {}": A is a B.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5 OCPBCD5
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11408
    
  16

I suppose there is a difference between a "class type" and a "class".


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
 
Consider Paul's rocket mass heater.
 
subject: IS-A confusion with practise exam question