Solved

Consider the Following Code Snippet

Question 22

Multiple Choice

Consider the following code snippet:
public class LinkedList<E>
{
private static E defaultValue;
public void add(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 as shown.
B) Cannot have an inner class in a generic class as shown.
C) Cannot declare the variable defaultValue as a generic data type.
D) Cannot declare the variable defaultValue as static.

Correct Answer:

verifed

Verified

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

Related Questions