Question: A Java task Question 8 (1 point) Assume that the following snippet of code compiles and runs correctly, and it is part of the main

Question 8 (1 point) Assume that the following snippet of code compiles and runs correctly, and it is part of the main method of a Test class which belongs to a package called quizzes. Candyll someCandies = new Candy (5); someCandies [0] = new Candy ("Marshmallows", "white"); someCandies [1] = new Candy ("Skittles", "yellow"); someCandies [2] = new Candy ("Sour Patch", "pink"); CandyStore sugarRush = new CandyStore (someCandies); Which of the following are valid ways (without compile-time or run-time error) to modify the candies stored in the store referenced by the variable sugarRush? (you can assume that each of the following snippets of code would be added in the line right after the variable sugarRush is declared and initialized): someCandies[4] = new Candy("Twizzlers", "red"); sugarRush.restock(new Candy("Smarties": "yellow")); sugarRush.candies = new Candy[1]; sugarRush.candies[0] = new Candy("Jelly Bean", "blue"); Candyl) c = sugarRush.getCandies(); Candy gb = new Candy("Gummy Bears", "yellow"); for (int i = 0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
