** Please help me out, I\'m trying to study for my final and this question is a
ID: 3660683 • Letter: #
Question
** Please help me out, I'm trying to study for my final and this question is a practice example to prepare myself for the final **
This problem is about the Stack ADT and about differences in object semantics and parameter passing in Java and C++. In the following programs assume that both Java and C++ have a generic/template Stack class with the usual operations (push, pop, top, isEmpty) with the usual meanings. Show the output for each of the following two programs that look roughly the "same" in C++ and Java. Show your answer for a program to the right of that program. Java program public class MainClass public static void myFun (Stack Integer s, Stack Integer t) s pop t s; public static void main (String args) Stack Integer new Stack Integer s push (3) s push (4) Stack Integer t new Stack Integer t push (9) t.push (7 System.out.println (s.top t-top 0); myFunc (s, t) System. println (s.top t-top 0); C++ program void my Func Stack int> s Stack kint t) s-pop t s; int main 0 Stack int s s-push (3) s-push (4) Stack int t; t-push (9) t-push (7); cout s -top t -top endl. my Func (s t) cout s -top t -top endl.Explanation / Answer
it print 1->2->3->1->2->3->1->2->3-> and so on. its a circular Link list
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.