title: Implement two stacks using one array
body: <p>I still don't know WHERE to implement the second Stack.  Am i supposed to make another class?  I'm not quite sure how to finish up.  I'll keep searching.  Any help would be appreciated!  I also can't tell if my pop() method is working or not.  I printed out the stack.<br>
  Output:
  true
  5
  10
  15
  20
  25
  30
  35
  false</p>
  
  <pre><code>public class twoStack {
      int maxSize = 10;
      int top;
      int top2;
      int arr[];
  
      public twoStack(int x) 
      {
          maxSize = x;
          arr = new int[maxSize];
          top = 0;
          top2 = maxSize;
      }
  
          //push pop empty peek
      public boolean empty()
      {
          if(top == 0)
          {
              return true;
          }
          else
          {
              return false;
          }
      }
      public boolean empty2()
      {
          if(top2 == maxSize)
          {
              return true;
          }
          else
          {
              return false;
          }
      }
      public void push(int x)
      {
          if (top&lt;maxSize)
          {
          arr[top] = 10;
          top++;
          }
          else 
          {
              System.out.print("Stack overflow");
          }
      }
      public void push2(int x)
      {
          if(top2&lt;0)
          {
              arr[top2] = 0;
                      top2--;
          }
          else
          {
              System.out.print("Stack Overflow");
          }
      }
      @SuppressWarnings("null")
      public Object pop()
      {
          if(!this.empty())
          {
              int temp = (int) this.peek();
              arr[top-1]=(Integer) null ;
              top--;
              return temp;
          }
          else
          {
              return null;
          }
      }
      @SuppressWarnings("null")
      public Object pop2()
      {
          if(!this.empty2())
          {
              int temp = (int) this.peek();
              arr[top+1]=(Integer) null;
              top++;
              return temp;
          }
          else
          {
              return null;
          }
      }
      public Object peek()
      {
          if (!this.empty())
          {
          return arr[top-1];
          }
          else
          {
              return null;
          }
      }
      public Object peek2()
      {
          if(!this.empty2())
          {
              return arr[top+1];
          }
          else
          {
              return null;
          }
      }
  
  }
  
  
  
  //mainstack
  package twoStack;
  
  import java.util.Stack;
  
  public class mainStack {
  
      public static void main(String[] args) {
  //MM(main method)
          Stack&lt;Integer&gt; myStack= new Stack&lt;Integer&gt;();
          System.out.println(myStack.empty());
          myStack.push(5);
          System.out.println(myStack.peek());
          myStack.push(10);
          System.out.println(myStack.pop());
          myStack.push(15);
          System.out.println(myStack.peek());
          myStack.push(20);
          System.out.println(myStack.peek());
          myStack.push(25);
          System.out.println(myStack.pop());
          myStack.push(30);
          System.out.println(myStack.peek());
          myStack.push(35);
          System.out.println(myStack.peek());
          myStack.push(40);
          System.out.println(myStack.empty());
  
  
  
  
  
  
      }
  
  }
  </code></pre>