Multiple Choice
You have created a Fruit class and a ShoppingCart class. Which of the following methods will correctly add a Fruit object to an array list named fruits in the ShoppingCart class?
A) public void add(Fruit aFruit)
{
Fruits.add(new Fruit(aFruit) ) ;
}
B) public void add(Fruit aFruit)
{
Fruits.add(aFruit) ;
}
C) public void add(Fruit aFruit)
{
Fruits.addItem(new Fruit(aFruit) ) ;
}
D) public void add(Fruit aFruit)
{
Fruits.addItem(aFruit) ;
}
Correct Answer:

Verified
Correct Answer:
Verified
Q33: Which of the following statements is true
Q34: Consider the following code snippet:<br>Public class Employee<br>{<br>Private
Q35: Consider the following code snippet:<br>Public class Vehicle<br>{<br>Private
Q36: Which of the following statements about classes
Q37: When an object is created from a
Q39: Insert the missing code in the following
Q40: A constructor is invoked when _ to
Q41: Consider the following code snippet:<br>Public class Employee<br>{<br>Private
Q42: Consider the following code snippet:<br>Public class Vehicle<br>{<br>Private
Q43: You have created an Employee class. You