• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

A exam sub. Can you help me?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
[email protected]
 
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot.
 
reply
    Bookmark Topic Watch Topic
  • New Topic