Question
When should a Java developer choose Arrays and Indexed Access deliberately?
- Choose Arrays and Indexed Access mainly when you want to postpone validation and fix problems manually later.
- Choose Arrays and Indexed Access whenever you want the code to look more advanced, even if the design gets less clear.
- Choose an array-backed structure when the size is known or controlled and the code depends on fast positional access.
- Choose Arrays and Indexed Access only to avoid modeling domain rules explicitly in Java code.
Hint
Think about the production scenario where the choice genuinely improves the code.
Answer and rationale
Correct answer: C. Choose an array-backed structure when the size is known or controlled and the code depends on fast positional access.
Choose an array-backed structure when the size is known or controlled and the code depends on fast positional access. Interviewers often ask this to see whether you can connect the concept to real design decisions.
Track: Java