Pregunta

Stack is a generic class in Java, it definition is class Stack<E> extends Vector<E>, but why I cannot instantiate it with type parameter like Stack<Integer> s = new Stack<>(); But a Vector can?

¿Fue útil?

Solución

Of course, it can.

    Stack<Integer> stack = new Stack<>();
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top