exam questions

Exam 1z0-808 All Questions

View all questions & answers for the 1z0-808 exam

Exam 1z0-808 topic 1 question 200 discussion

Actual exam question from Oracle's 1z0-808
Question #: 200
Topic #: 1
[All 1z0-808 Questions]

Given:

What is the result?

  • A. true
  • B. false
  • C. -1
  • D. 0
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Jess1985B
3 weeks ago
Since p1 is not added to previous list so if you try accessing its Index position it would give you -1.
upvoted 1 times
...
carloswork
1 year, 1 month ago
Selected Answer: C
Answer is C. To test: import java.util.ArrayList; import java.util.List; class Product { int id; String name; Product (int id, String name){ this.id = id; this.name = name; } } public class Test { public static void main(String[] args) { List <Product> Ist = new ArrayList<>(); Ist.add(new Product(10, "IceCream")); Ist.add(new Product(11, "Chocolate")); Product p1 = new Product(10, "IceCream"); System.out.println(Ist.indexOf(p1)); } }
upvoted 1 times
...
iSnover
1 year, 2 months ago
Selected Answer: C
The answer is C. even p1 having the same content as lst[0], they are different objects so it will return "-1" which is what it returns when we use the "indexOf" constructor and we don't find anything equal to the parameter we used.
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago