Q. Which of the following is a valid declaration and initialization of a String array in Java?
β
Correct Answer: (D)
String[3] names = {"Alice", "Bob", "Charlie"};
D.
Both A and B
Explanation: Option A initializes a String array named "names" with three elements: "Alice", "Bob", and "Charlie".