Solved

Select an Appropriate Expression to Complete the Following Code Segment

Question 33

Multiple Choice

Select an appropriate expression to complete the following code segment, which is designed to print a message if the string stored in name is the first element of the players linked list. LinkedList<String> players = new LinkedList<String>() ;
// code to add elements to the linked list
If ______________________________________
System.out.print(name + " is the first player on the list.") ;


A) (players.indexOf(name) == 1)
B) (players.contains(name) )
C) (players.getFirst() .equals(name) )
D) (players[0].equals(name) )

Correct Answer:

verifed

Verified

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

Related Questions