Here is my code:
package datastructures; import java.util.Iterator; public class Stack{ private class Node{ T data; N
When you declare Node as
private class Node
you're declaring a generic type with another T as the T in the enclosing type. You're hiding T. So, in short, it's as if you were declaring it as
Just use