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"
Garrett Rowe
Ranch Hand
Joined: Jan 17, 2006
Posts: 1295
posted
0
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
Ranch Hand
Joined: Mar 02, 2008
Posts: 87
posted
0
thanks Garrett! any ideas on where i can find information on generics?
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35223
7
posted
0
You could with the Sun Java Tutorial chapters on generics: here and then here