Services
Discover
Homeschooling
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
Big Java Late Objects
Quiz 18: Generic Classes
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 21
Multiple Choice
Consider the following code snippet: Public static <E> void print(E [] a) { For (int i = 0; i < a.length; i++) { System.out.println(a[i] + " ") ; } } Int[] a = {3,6,5,7,8,9,2,3}; String[] s = {"happy","cat","silly","dog"}; Boolean[] b = {true, true, false}; Which of the following are correct calls to this generic print method? I print(a) ; II print(s) ; III print(b) ;
Question 22
Multiple Choice
Which of these Java library classes are implemented using type variables? I HashMap II LinkedList III ArrayList
Question 23
Multiple Choice
Select the correct header for this generic print method. Public static void print(E[] a) { For (int i = 0; i < a.length; i++) { System.out.println(a[i] + " ") ; } }
Question 24
Multiple Choice
The type variables in HashMap<K, V> in the standard library mnemonically represent ____.
Question 25
Multiple Choice
Consider our own generic class MyLinkedList shown below. It has a private Node class, and it implements the standard Java ListIterator generic interface. Public class MyLinkedList<E> { Private MyNode first; ) . . Private class MyNode { Private E data; Private MyNode next; } Private class MyIterator implements ListIterator<E> { ) . . } } Which of the following statements apply? I the code is correct II change to private class MyIterator implements ListIterator III change to private class MyNode<E>
Question 26
Multiple Choice
Determine the correctness of the MyLinkedList generic class code below. Public class MyLinkedList<E> { Private MyNode first; Public E getFirst() { return first.data; } Private class MyNode { Private E data; Private MyNode next; } }