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.
Imagination is more important than knowledge "Albert Einstein"
Joined: Jan 17, 2006
You're mixing generic Node<T>s and raw Nodes:
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
f. nikita thomas
Joined: Mar 02, 2008
thanks Garrett! any ideas on where i can find information on generics?
Joined: Mar 22, 2005
You could with the Sun Java Tutorial chapters on generics: here and then here