Question: 46. Trace the following code segment and show its expected output. Normally when tracing application code that uses an ADT you need not worry about

46. Trace the following code segment and show its expected output. Normally when tracing application code that uses an ADT you need not worry about the details of the code implementation. But for this exercise we want you to "wear the hat" of the implementer and carry your tracing down to the implementation level so that you can see exactly what is returned by the t oSt ring methods. Explain why the two StringLogs are not displayed in exactly the same way St ringLogInt erface info1; St ringLogInt erface inf o2; info! new ArrayStringLog( "Information 1"); i nfo2 - new Li nkedSt r i ngLog("I nf or mation 2") infol.insert("To ) ; i nfo2. 1 ns er t ( " Tom!) ; i nfol. insert ("Julie"); i nf o2. i nsert ("Julie"); Syst em out print l n(i nfo1. toString()); Syst em out printl n(info2. t oSt ring))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
