Multiple Choice
Consider the following code snippet: public class SavingsAccount extends BankAccount { . . . }
Public class CheckingAccount extends BankAccount { . . . }
) . .
SavingsAccount[] savingsAccounts = new SavingsAccount[100]; //Line 1
BankAccount bankAccounts = savingsAccounts; //Line 2
BankAccount myAccount = new CheckingAccount() ; //Line 3
BankAccounts[0] = myAccount; //Line 4
Which of the following statements regarding this code is correct?
A) Line 2 will cause a compile-time error.
B) Line 2 will cause a run-time error.
C) Line 4 will cause a compile-time error.
D) Line 4 will cause a run-time error.
Correct Answer:

Verified
Correct Answer:
Verified
Q22: Consider the following code snippet: ArrayList<Coin> coins1
Q23: Generics limit Java code somewhat. Which of
Q24: Which of the following are restrictions of
Q25: Which of the following statements about using
Q26: Consider the following code snippet: public class
Q28: Consider our own generic class MyLinkedList shown
Q29: Given the following generic method, which of
Q30: Suppose a linked-list class with a generic
Q31: Consider the following class declaration: public class
Q32: Suppose a generic method accepts a generic