link temp firstfirst first nextnext return temp/delete first item /(assumes list not empty/save reference to link /delete itfirst-->old /return deleted link /public void displaylist(system out print("list (first-->last)")link current first/start at beginning of list while(current !null/until end of listcurrent displaylink()/print data current current next/move to next link system out println("")//end class linklist ///////////////////////////////////////////////////////////////class linklistapp public static void main(string[argslinklist thelist new linklist()/make new list thelist insertfirst( )thelist insertfirst( )thelist insertfirst( )thelist insertfirst( )/insert four items thelist displaylist()/display list while!thelist isempty(/until it' emptylink alink thelist deletefirst()/delete link system out print("deleted ")/display it alink displaylink()system out println("")thelist displaylist()/display list /end main(/end class linklistapp