When I run the following code:
class MyStack<T>
{
private T[] stack;
... private T top;
private static final int size=50;
public MyStack()
{
stack = new int[size];
top = 0;
}
}
I get this error
MyStack.java:18: generic array creation
stack = new T[size];
...
1 error
What should the proper code be, so I dont get this error