MCQOPTIONS
Saved Bookmarks
| 1. |
What is the output of this program? public class BoxDemo { public static void addBox(U u, java.util.List> boxes) { Box box = new Box<>(); box.set(u); boxes.add(box); } public static void outputBoxes(java.util.List> boxes) { int counter = 0; for (Box box: boxes) { U boxContents = box.get(); System.out.println("Box #" + counter + " contains [" + boxContents.toString() + "]"); counter++; } } public static void main(String[] args) { java.util.ArrayList> listOfIntegerBoxes = new java.util.ArrayList<>(); BoxDemo.addBox(Integer.valueOf(10), listOfIntegerBoxes); BoxDemo.outputBoxes(listOfIntegerBoxes); } } |
| A. | 10 |
| B. | Box #0 [10]. |
| C. | Box contains [10]. |
| D. | Box #0 contains [10]. |
| Answer» E. | |