Solved

Consider the Following Code Snippet

Question 43

Multiple Choice

Consider the following code snippet:
public class LinkedList<E>
{
private E defaultValue;
public void add(E value, int n) { ...}
private static class Node { public E data; public Node next; }
...
}
What is wrong with this code?


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

Correct Answer:

verifed

Verified

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

Related Questions