Solved

Consider the Following Code Snippet

Question 42

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?


A) Cannot pass a generic type as an argument to a method.
B) Cannot have a static method in a generic class as shown.
C) Cannot have an inner class in a generic class.
D) Cannot declare the variable defaultValue as a generic type.

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions