This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Grokking Bitcoin and have Kalle Rosenbaum on-line!
See this thread for details.
Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

is a relationship  RSS feed

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which two demonstrates �is a� relationship

A.public interface Person { }
public class Employee extends Person { }

B. public interface Shape { }
public class Employee extends Shape { }

C. public interface Color { }
public class Employee extends Color { }

D. public interface Species { }
public class Animal { private Species species;}

E. interface component { }
class container implements component { private component [] children;}


Ans: D, E

I did not understood meaning of this type of question; it would be nice if someone can help me. What exact meaning of is arelationship?

Thank you in advance.
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A/B/C are wrong bcoz a class cant extend an interface.
moreover I am still wondering how D & E r right opton.
 
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hint: IS A relationship can be tested by using instanceof operator

Try that
 
Nitin Bhagwat
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Jay
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wonder that the option D as well is wrong since that would be of the type : "has a" relation rather than "is a" relation.

Inheritance can be said as is a relation while aggregation can be said as has a relation.

let me know if this is ok..
Murali
 
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Muralidhar. Option D represents a "HAS-A" relationship.
 
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If we could know the source of this question then it would be easy to find out what exactly was the question.

It may have asked for only 1 option right.

kaps
 
I like tacos! And this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!