Shortcut Navigation:

Java Io PrintWriter Quiz

Suppose that you would like to create an instance of a new Map that has an iteration order that is the same as the iteration order of an existing instance of a Map. Which concrete implementation of the Map interface should be used for the new instance?

You need to store elements in a collection that guarantees that no duplicates are stored and all elements can be accessed in natural order. Which interface provides that capability?

Which statement is true for the class java.util.HashSet?

Which statement is true for the class java.util.ArrayList?

You need to store elements in a collection that guarantees that no duplicates are stored. Which two interfaces provide that capability? (Choose Two)

Which interface provides the capability to store objects using a key-value pair?

Which interface does java.util.HashTable implement?

The file MyNewVector.java is shown in the exhibit. What is the result? package foo; import java.util.Vector; private class MyVector extends Vector { int i = 1; public MyVector() { i = 2; } } public class MyNewVector extends MyVector { public MyNewVector () { i = 4; } public static void main (String args []) { MyVector v = new MyNewVector(); } }

Given: ArrayList a = new ArrayList(); a.add(“Alpha”); a.add(“Bravo”); a.add(“Charlie”); a.add(“Delta”); Iterator iter = a.iterator(); Which two, added at end, print the names in the ArrayList in alphabetical order? (Choose 2)

Given: // Point X public class foo { public static void main(String[]args)throws Exception{ java.io.PrintWriter out = new java.io.PrintWriter(); new java.io.OutputStreamWriter(System.out),true); out.println(“Hello”); } } What line of code should be inserted at Point X to make this program compile?