Ask Question
28 June, 23:16

To initialize a String array names to store the three Strings "Huey", "Duey" and "Louie", you would do:

a) String names = {"Huey", "Duey", "Louie"};

b) String[ ] names = {"Huey", "Duey", "Louie"};

c) String[ ] names = new String{"Huey", "Duey", "Louie"};

d) String names[3] = {"Huey", "Duey", "Louie"};

e) String names; names[0] = "Huey"; names[1] = "Duey"; names[2] = "Louie";

+4
Answers (1)
  1. 28 June, 23:33
    0
    B) String[ ] names = {"Huey", "Duey", "Louie"};

    Explanation:

    In Java programming language, arrays are declared by first Writing the data type of the elements that will be stored in the array, in this case String. This is followed by square brackets indicating that the variable is an array, followed by the array name which must follow the rules of naming variables. The example below is a valid declaration of an array.

    String[ ] names;

    Next in java we can initialize the elements either by using the new keyword and specifying the length of the array to create the array in memory like this;

    String[ ] names = new String[3];

    Or we initialize by assigning values in curly braces seperated by commas like in the question ablove.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “To initialize a String array names to store the three Strings "Huey", "Duey" and "Louie", you would do: a) String names = {"Huey", "Duey", ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers