Engineering Homework Help
Which of the following pairs is an example of anis-arelationship?a.Computer,
Which of the following pairs is an example of an is-a relationship?
a.Computer,
Disk
b.Apple, Orange
c.Laptop, Computer
d.Car, Engine
Which Java statement is used to declare a class Triangle that is derived from class Shape?
a.public class Triangle implements Shape
b.public class Triangle extends Shape
c.public class Triangle is-a Shape
d.public class Triangle
A Java object can be a field in another Java object.
a.True
b.False
Which method is automatically called when a Java object is instantiated?
a.Constructor
b.Accessor
c.Mutator
d.Utility
Assume that you have created a class named Dog that contains a data field namedweight and an instance method named setWeight(). Further assume that the setWeight() method is public and accepts a numeric parameter named pounds. Which of the following statements correctly sets a Dog‘s weight within the setWeight() method?
a.pounds = weight
b.weight = pounds
c.either of these
d.none of these