title: Creating an ArrayList based Stack and Using in Palindrome Detector
body: <p>I need to create a myStack class and then use it to test for Palindromes... I chose to create an ArrayList based implementation of the stack. </p>
  
  <pre><code>    import java.util.ArrayList;
  
      public class myStack&lt;AnyType&gt;{
          private ArrayList&lt;AnyType&gt; arr;
  
          public myStack(ArrayList&lt;AnyType&gt; a){
              arr = a;
          }
  
          public void push(AnyType element) {
                      arr.add(element);
          }
  
          public AnyType pop() {
              if(arr.size() == 0)
              {
                      System.out.println("Stack Underflow");
                      return null;
              }
              else
              {
                      AnyType element = arr.get(arr.size() -1);
                      arr.remove(element);
                      return element;
              }
          }
  
          public AnyType top() {
              if(arr.size() == 0)
              {
                      System.out.println("Stack Underflow");
                      return null;
              }
              else
                      return(arr.get(arr.size() -1));
          }
     }
  </code></pre>
  
  <p>Then I use it in a class called Palindrome (not complete yet)</p>
  
  <p>However, when I compile, it tells me 
  "Note: Palindrome.java uses unchecked or unsafe operations.
  Note: Recompile with -Xlint:unchecked for details."</p>
  
  <p>When I comment out the line myStack m = new myStack(test);</p>
  
  <p>It compiles, so I know this is the problem... Why would the myStack class be the problem? Is it something to do with the "AnyType" I used in the stack class? </p>