File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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

IS-A confusion with practise exam question

Stephen Pengilley

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!


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.

K. Tsang

Joined: Sep 13, 2007
Posts: 3132

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 OCPJP7 OCPWCD5 OCPBCD5 OCPWSD5 OCMJEA5 part 1 part 2/3
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11955

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
I agree. Here's the link:
subject: IS-A confusion with practise exam question
It's not a secret anymore!