?
Which one of the following is a valid statement?
Answer & Solution
Correct Answer:
Option
B
The syntax for declaring and creating an array variable in java is:
dataType[] arrayRefVar = new dataType[arraySize];
Thus, option (A) and option (C) is syntactically wrong as parentheses( ( ) ) is used instead of square brackets( [ ] ).
Option (D) is incorrect as the size of the array is missing.
Join the Discussion
Login to post a comment or share your explanation.
Login