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

TRUE OR FALSE: (List a small explaination as to why it is true or false) 1. Just

ID: 3676636 • Letter: T

Question

TRUE OR FALSE: (List a small explaination as to why it is true or false)

1. Just as arrays can only have a fixed number of elements, set at the time the array is declared, a parameter list also can only have a fixed number of elements, set at the time the method is declared.

2. Any class can implement an interface, but no classes can implement more than a single interface.

3. An item of type ProduceItem may be added to an ArrayList of type ArrayList<GenericItem>.

4. The Java virtual machine (JVM) automatically performs runtime polymorphism to determine the correct method to call.

5. A class having an abstract method implies that objects of that class type cannot be defined.

6. A class defined as "abstract" must contain an abstract method.

7. Implementing an interface means that you are adding to your class any mechanisms defined in an abstract class. Your class essentially is expanded to contain those items defined in the interface class but you have to implement any of those items that are abstract. The appeal is that other objects might call upon your class to use the interface methods without knowing anything else about your class. The derived class is similar in that you are gaining items previously defined, although in this case, those items are defined in the parent class (as long as those items are protected or public) and you do not have to implement any of them unless you want to redefine them. One difference between the two is that the interface cannot be instantiated directly. Another difference is that your class "inherits" abstract methods from the interface class as opposed to implemented methods from a super class. Are all these statements TRUE or FALSE?

Explanation / Answer

Please find the answers below :

1) False; parameters can also be specified as variable arguments

2) True; multipe inheritance is not allowed in java, as it will cause diamond problem

3) True, if ProduceItem is a type of genericItem

4) True

5) True, it will be an abstract class, and an abstract class cannot be instantiated

6) True; an abstract class must have atleast one abstract method