wood burning stoves 2.0*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 1963
    
    7

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
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 10911
    
  12

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: http://aspose.com/file-tools
 
subject: IS-A confusion with practise exam question
 
Similar Threads
page 159 of Sierra/Bates book
problem in "instanceof" operator and "searching(regex)"
instanceof
Objective 7.6 Java Operators (instanceof) Operator
Passed with 89%