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 Binder Early Objects
Quiz 18: Generic Classes
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 61
Multiple Choice
Generics limit Java code somewhat. Which of the following are considered limitations of generic code? I cannot have an array of a generic type II cannot have primitive type variables III cannot construct an object of a generic type
Question 62
Multiple Choice
Consider the following code snippet: public static <E extends Measurable> E min(E[] objects) Which of the following represents the result of type erasure on this code?
Question 63
Multiple Choice
Consider the following code snippet: public interface MyInterface<E> { . . . } Public interface YourInterface<E, T> extends MyInterface<E> { . . . } Which of these are legal class declarations? I public class SomeClass implements YourInterface<String, Double> { . . . } II public class SomeClass implements YourInterface { . . . } III public class SomeClass implements YourInterface<String> { . . . }
Question 64
Multiple Choice
Generics limit Java code somewhat. Which of the following are limitations of generic code? I cannot declare static variables of a generic type II cannot declare static methods of a generic type III cannot declare static inner classes of a generic type
Question 65
Multiple Choice
Consider the following code snippet: public class LinkedList<E> { Private E defaultValue; Public static List<E> replicate(E value, int n) { . . . } Private class Node { public String data; public Node next;) ) . . } What is wrong with this code?
Question 66
Multiple Choice
If a class requires two generic type variables, how many can you legally provide in Java? I 0 II 1 III 2
Question 67
Multiple Choice
Suppose a generic method accepts a generic unconstrained argument p. What restrictions are placed on p by the compiler?
Question 68
Multiple Choice
Which of the following necessitates the type erasure process? I The Java virtual machine does not work with generic types II To maintain backward compatibility to older versions of Java III Generics do not work with primitives