Advertisement
Guest User

Untitled

a guest
Apr 19th, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. int p2 = n;
  2. push (Object data) {
  3. if (p1 + p2 == n)
  4. throw new StackOverFlow exeption
  5. else {
  6. p2--;
  7. arr[p2] == data;
  8. }
  9. }
  10.  
  11. Object pop () {
  12. if (!isEmpty()) {
  13. Object data = arr[p2];
  14. p2++;
  15. return data;
  16. }
  17. }
  18.  
  19. boolean isEmpty() {
  20. if (p2 >= n)
  21. return true;
  22. return false;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement