public class StackProgram { public static void main(String[]args) { StackClass i
ID: 3653006 • Letter: P
Question
public class StackProgram { public static void main(String[]args) { StackClass inStack = new StackClass(50); StackClass tempStack = new StackClass(); try { intStack.push(new IntElement(23)); intStack.push(new IntElement(45)); intStack.push(new IntElememt(38)); } catch(StackOverflowException sofe) { System.out.println(sofe.toString()); System.exit(0); } tempStack.copyStack(instack); //copy instack // into tempStack System.out.print("tempStack elements: "); while(!tempStack.isEmptyStack()) //print tempStack { System.out.print(tempStack.top() + " "); tempStack.pop(); } System.out.println(); System.out.println("The top element of inStack: " + inStack.top()); } }Explanation / Answer
can you please format the code in lines??
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.