• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A exam sub. Can you help me?

 
ge yinglong
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,my friend
Is it right?

70.Which two demonstrate an �is a � relationship?(choose two.)again 2
A.public interface Person {}
public class Employee extends Person{}
B.public interface Shape {}
public interface Rectangle extends shape{}
C.public interface Color {}
public class Shape { private Color color; }
D.public class Species {}
public class Animal { private Species species; }
E.interface Component {}
class container implements Component {
private Component[] children;
}
answer: A, D
geyinglong@etang.com
 
Jamal Hasanov
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Answers are : B and E
Explanation:
A. public interface Person {}
public class Employee extends Person{}
FALSE - wrong declaration - class can implement interface, not extend
B. public interface Shape {}
public interface Rectangle extends shape{}
TRUE - Rectangle is a Shape
C. public interface Color {}
public class Shape { private Color color; }
FALSE - sample of "has a" relationship - "Shape has a Color"
D. public class Species {}
public class Animal { private Species species; }
FALSE - sample of "has a" relationship - "Animal has a Species"
E. interface Component {}
class container implements Component {
private Component[] children;
}
TRUE - Container is a Component.
BTW, there's a "has a" relationship,too - "Container has a Component"
I can suggest you RHE preparation book for this topic.
Jamal Hasanov
www.j-think.com
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"geyl"
Welcome to the JavaRanch! Please adjust your displayed name to match the JavaRanch Naming Policy.
You can change it here.
Thanks! and again welcome to the JavaRanch!
 
ge yinglong
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic