Solved

You Have Created a Fruit Class and a ShoppingCart Class

Question 65

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:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents