95.6k views
4 votes
Assume that an LinkedList of String objects named list has been declared, initialized and has the following strings: [""A"", ""B"", ""C"", ""D""].

Which of the following expressions would return a boolean expression depending on whether list has ""A""?
True
False

1 Answer

3 votes

Final answer:

The expression list.contains("A") would return true or false depending on whether the LinkedList has "A".

Step-by-step explanation:

The expression that would return a boolean depending on whether the LinkedList list has "A" is:

list.contains("A")

This expression checks if the LinkedList contains the element "A" and returns a true or false value accordingly. In this case, since "A" is present in the LinkedList, the expression would return true.

User Liran Orevi
by
9.1k points