+ 1

Consider the following JAVA program

import java.util.Vector; public class Item2test { Item2test() { GroceryItem d1 = new GroceryItem("Wiskat","cndfoods", "catfood",100, 50, 1.79); GroceryItem d2 = new GroceryItem("Barkat","cndfoods", "dogfood",130, 40, 9.53); GroceryItem d3 = new GroceryItem("birdseed","bfoods", "seed",1200, 50, 1.79); GroceryItem d4 = new GroceryItem("fishfood","goldfoods", "pellets",170, 40, 9.53); Vector v = new Vector(); v.add(d1); v.add(d3); v.add(1,d4); v.get(1); GroceryItem d5 = (GroceryItem)(v.get(1)); d5.outdisplay(); d5 = (GroceryItem)(v.get(0)); d5.outdisplay(); v.remove(0); v.add(0,d5); d5 = (GroceryItem)(v.get(0)); d5.outdisplay(); } public static void main (String[] args) { new Item2test();} } Describe in your own words what is happening. In particular describe what is happening in the line GroceryItem d5 = (GroceryItem)(v.get(1));

30th Dec 2017, 5:34 PM
Martin Toomey
Martin Toomey - avatar
1 ответ
0
Please copy and paste this into the code playground will help me, help you and if you want even more people to help, name the code in the playground something that includes "help"
8th Jan 2018, 5:17 AM
DeleteThisAccount