title: Using stacks to reverse string?
body: <p>This is my code so far, I need to create a reverse string so input= "hello" will output = "olleh"... The errors I'm having is in push and pop part of the code. I can't use StringBuffer. The error is -</p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.Error: Unresolved compilation
    problems:  l cannot be resolved l cannot be resolved</p>
    
    <p>at E.reverse(E.java:10) at E.main(E.java:17)</p>
  </blockquote>
  
  <p>Can you please help?</p>
  
  <pre><code>public class Rev {
  
      public static String reverse(String s) {
  
          MyStack st = new MyStack();
          while (!s.isEmpty()) {
              String k = st.toString();
              st.push(s);
          }
          while (!s.isEmpty()) {
              String p = st.pop();
              return s;
          }}
          public static void main(String[] args) {
              System.out.println(reverse("hello"));
      }
  }
  </code></pre>