diff --git a/Semester 2 (DSA)/assignment 3/a3q18.java b/Semester 2 (DSA)/assignment 3/a3q18.java index 3d1c702..1775051 100644 --- a/Semester 2 (DSA)/assignment 3/a3q18.java +++ b/Semester 2 (DSA)/assignment 3/a3q18.java @@ -66,7 +66,7 @@ void pop() } catch(StackUnderflowException e) { - //e.printStackTrace(); + e.printStackTrace(); } } else @@ -80,7 +80,7 @@ int peek() } else { - //System.out.print("Queue is Empty, Nothing to show"); + System.out.print("Queue is Empty, Nothing to show"); return -1; } } @@ -94,7 +94,7 @@ void push(int i) } catch(StackOverflowException e) { - //e.printStackTrace(); + e.printStackTrace(); } } else @@ -106,16 +106,8 @@ void push(int i) int[] show() { if(top==-1) - { - try - { - throw new QueueEmptyException("Queue is empty Nothing to Show"); - } - catch(QueueEmptyException e) - { - //e.printStackTrace(); + { return null; - } } else { @@ -158,10 +150,3 @@ class StackOverflowException extends Exception super(s); } } -class QueueEmptyException extends Exception -{ - QueueEmptyException(String s) - { - super(s); - } -} \ No newline at end of file