I wrote a stack, with static Node and other non-static.
public class Stack<E> implements Iterable<E>
{
private int N;
private Node<E> first;
private static class Node<E> // This works fine.
{
private E item;
private Node<E> next;
}
}
But when I try to make Node non-static, it gives me this warning "Type E parameter hides type E"
public class Stack<E> implements Iterable<E>
{
private int N;
private Node<E> first;
private class Node<E> // This shows warning.
{
private E item;
private Node<E> next;
}
}
A little understanding, which I am talking about, since the static memeber is a member of the class, so it does not give me a warning, but when I make it non-static, it belongs to the instance. But this is not a clear idea.
source
share