Skip to main content
gamedev.net
🔒 Locked

[java] What does this mean?

Started by The Orange Peanut Apr 11, 2006 at 8:44 PM 5 replies 1.3k views
Original Post
The Orange Peanut
The Orange Peanut
I am trying to write a stack class because that is what we are discussing in class and I have a feeling I'll have to implement a function from the ADT, so I want to get a head start. Well, I have written a node class because I am going to implement the stack using a linked list rather than an array and it compiles fine. I wrote the constructor for my stack class and it works fine as well with the exception of a warning. The warning reads Note: C:\MyProjects\MyStack\MyStack.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Here is my code. I think it might have something to do with my use of generics since I haven't had much practice using them, but if it isn't generics then I don't know what the problem could be as my linked list class works fine and it follows the same formula, more or less. Thanks.

public class MyStack <e>
{
	private int size;
	private sNode head;
	private sNode tail;
	
	MyStack()
	{
		size = 0;
			//	 prev  next  elem
		head = new sNode(null, null, null);
		tail = new sNode(head, null, null);
		head.setNext(tail);
	}
}

Dat is off da hizzle fo shizzle dizzle
The Orange Peanut
The Orange Peanut
I don't know how to do that. I don't use the command line, I use an IDE. Also, I just reworked my node and stack to use Integer s instead of and it works. I suppose the problem is with my generics after all...
Dat is off da hizzle fo shizzle dizzle
dega512
dega512
If you use JCreator:

1. Project->Project Properties in the menu
2. Click the JDK Tools tab, make sure Compiler is selected, then double click
3. Click the parameters tab and at the start of the text box put "-Xlint:unchecked " (without the quotes)
It's easy as 01, 10, 11
Fred304
Fred304
post the source for sNode.
LorenzoGatti
LorenzoGatti
It is MyStack, but where and how is e referenced? You should post not only sNode, but the whole MyStack class.
Omae Wa Mou Shindeiru

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.