Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 : Given the two java source files below and the matching input, what is the final output of the program ( show your work
: Given the two java source files below and the matching input, what is the final output of the program show your work by using boxes and arrowsrefer mostly to blue boxes in picture attached: Given the two java source files below and the matching input, what is the final output of the program show your
work by using boxes and arrows
public class CallplaylistSong
public static void mainString args
PlaylistSong headObj null;
PlaylistSong firstSong null;
PlaylistSong secondSong null;
PlaylistSong thirdSong null;
PlaylistSong currObj null;
headObj new PlaylistSong head;
firstSong new PlaylistSong Egmont;
headObj.insertAfterfirstSong ;
secondSong new PlaylistSong Fidelio;
firstSong.insertAfter secondSong ;
thirdSong new PlaylistSong Nocturne;
secondSonginsertAfterthirdSong;
currObj headObj;
while currobj null
currObj.PrintNodeData ;
currObj currObj.GetNext ;
public class PlaylistSong
private String name;
private PlaylistSong nextPlaylistSongRef;
PlaylistSong
this. name ;
nextPlaylistSongRef null;
PlaylistsongString name
this. name name;
this.nextPlaylistSongRef null;
PlaylistSongString name, PlaylistSong nextLoc f
this. name name;
this.nextPlaylistSongRef nextLoc;
void insertAfterPlaylistSong nodeLoc
Playlistsong tmpNext null;
tmpNext this.nextPlaylistSongRef;
this.nextPlaylistSongRef nodeLoc;
nodeLoc.nextPlaylistSongRef tmpNext;
PlaylistSong GetNext
return this.nextPlaylistSongRef;
Void PrintNodeData
System.out.println this name:
headObj null
headObj firstSong null
tmpNext null
tmpNext null headObj "head" & null
headObj "head" & null firstSong "Egmont" & null
headObj "head" & null firstSong "Egmont" & null
tmpNext firstSong
I
tmpNext firstSong
headObj firstSong secondSong thirdSo
Output:
head
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started