PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You are modifying an existing application.
The application includes a Loan class and a Customer class. The following code segment defines the
classes.

You populate a collection named customer-Collection with Customer and Loan objects by using the
following code segment:

You create a largeCustomerLoans collection to store the Loan objects by using the following code
segment:
Collection<Loan> largeCustomerLoans = new Collection<Loan>();
All loans with an Amount value greater than or equal to 4000 must be tracked.
You need to populate the largeCustomerLoans collection with Loan objects.
Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
Option A

B.
Option B

C.
Option C

D.
Option D

Explanation:
Must add to the largeCustomerLoans collection, not the customerLoanCollection.
We iterate through each customer in customerCollection and check each loan belonging to this
customer.

One Comment on “Which code segment should you use?


Leave a Reply