Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java You have a class in your program called Animal that has methods for eat, sl

ID: 3920088 • Letter: J

Question

Java

You have a class in your program called Animal that has methods for eat, sleep, and move. You need to create a Bird class, with a different implementation of the move method. What relationship should the Bird class have with the Animal class?

Question 4 options:

aggregation

inheritance

encapsulation

overloading

Question 5

What is the relationship between the Car and Engine classes shown below?

class Car {
     private String make;
     private String model;
     private int year;
     private Engine engine;
     …}

public class Engine {
     private String manufacturer;
     private int numberOfCylinders;
     …
}

Question 5 options:

inheritance

aggregation

overriding

overloading

Question 6

Which of these is an example of auto unboxing?

Question 6 options:

int x = 5;

Integer y = x;

Integer x = new Integer(5);

ArrayList myList = new ArrayList();

myList.add(5);

ArrayList myList = new ArrayList();

myList.add(new Integer(5));

int x = myList.get(0);

aggregation

inheritance

encapsulation

overloading

Explanation / Answer

4) inheritance 5) aggregation 6) ArrayList myList = new ArrayList(); myList.add(new Integer(5)); int x = myList.get(0);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote