MCQs>IT & Programming>Java>How can the string '1 2 3 3 4 4 5 1' be added to an ArrayList where each number separated by a space is added as a separate list item, and the list cannot have duplicates?
Java MCQs
How can the string "1 2 3 3 4 4 5 1" be added to an ArrayList where each number
separated by a space is added as a separate list item, and the list cannot have
duplicates?
Answer
Correct Answer: Check if the ArrayList already contains the same string using the contains()
method.
Explanation:
Note: This Question is unanswered, help us to find answer for this one