Java OCA OCP Practice Question 458

Question

Which of the following statements will correctly create and initialize an array of Strings to non null elements?

Select 4 options

  • A. String [] sA = new String [1] { "Java"};
  • B. String [] sA = new String [] { "Java"};
  • C. String [] sA = new String [1] ; sA [0] = "Java";
  • D. String [] sA = {new String ( "Java")};
  • E. String [] sA = { "Java"};


Correct Options are  : B C D E

Note

A. is wrong. Array size cannot be given here as the array is being initialized in the declaration.




PreviousNext

Related