Solved

Consider the Following Code Snippet: LinkedList<String> Words = New LinkedList<String>();

Question 26

Multiple Choice

Consider the following code snippet: LinkedList<String> words = new LinkedList<String>() ;
Words.addLast("abc") ;
Words.addLast("def") ;
Words.addLast("ghi") ;
System.out.print(words.removeLast() ) ;
System.out.print(words.removeFirst() ) ;
System.out.print(words.removeLast() ) ;
What will this code print when it is executed?


A) abcdefghi
B) ghiabcdef
C) abcghidef
D) defghiabc

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions