Advertisement
Alekss33

Untitled

Apr 21st, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. package com.telerikacademy;
  2.  
  3. public class Main {
  4.  
  5. public static void main(String[] args) {
  6. Stack myStack = new StackImpl();
  7. System.out.println("Empty stack: "+myStack.isEmpty());
  8. myStack.push(1);
  9. myStack.push(2);
  10. myStack.push(3);
  11. System.out.println(myStack.peek());
  12. myStack.pop();
  13. System.out.println(myStack.peek());
  14. System.out.println(myStack.isEmpty());
  15.  
  16. Queue myQueue = new QueueImpl();
  17. System.out.println("In empty queue the size is: "+myQueue.size());
  18. myQueue.offer(100);
  19. myQueue.offer(300);
  20. myQueue.offer(600);
  21. System.out.println(myQueue.isEmpty());
  22. System.out.println(myQueue.peek());
  23. myQueue.poll();
  24. myQueue.poll();
  25. System.out.println(myQueue.peek());
  26.  
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement