title: Java: Stack.pop() + incompatible types
body: <p>this is the first time I'm working with the Stack-structure. Here's the basic idea: I'm writing a text-based-adventure where the player can visit different rooms. Currently he can't go back. I thought I might use a Stack to document his movements. So if he moves on into a different room I used push() to put the currentCity (Which is an Object of the class City) onto the Stack. It looks like that:</p>
  
  <pre><code>private Stack history;
  </code></pre>
  
  <p>In the Constructor:</p>
  
  <pre><code>history = new Stack();
  </code></pre>
  
  <p>In the "go"-function:</p>
  
  <pre><code>history.push(currentCity)
  </code></pre>
  
  <p>If I try to retrieve the Object in my goBack-function like this:</p>
  
  <pre><code>currentCity = history.pop();
  (currentCity is a private variable of the class I'm working in. It's of the type
  City)
  </code></pre>
  
  <p>I thought that would work because the object ontop of my Stack is from the type City and so is the variable currentCity. Still I get incompatible types.</p>
  
  <p>Any help would be greatly appreciated,
  stiller_leser</p>