posted 15 years ago
warnings/errors:
javac -Xlint:unchecked GenericStack.java
GenericStack.java:10: warning: [unchecked] unchecked call to Node(T) as a member of the raw type GenericStack.Node
first = new Node(item);
^
GenericStack.java:17: warning: [unchecked] unchecked cast
found : java.lang.Object
required: T
T obj = (T)first.obj;
^
2 warnings
so what is the safe way of doing this without the cast? are there any resources for generics on the web? my textbook glazed over this like the plague. thanks.
nikita
Imagination is more important than knowledge "Albert Einstein"