SHARE
TWEET

Untitled

Alekss33 Apr 21st, 2019 (edited) 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top