1.

Which of these is an incorrect Statement?(a) It is necessary to use new operator to initialize an array(b) Array can be initialized using comma separated expressions surrounded by curly braces(c) Array can be initialized when they are declared(d) None of the mentionedI got this question in an interview.My question is based upon Arrays topic in section Data Types, Variables and Arrays of Java

Answer»

Right answer is (a) It is necessary to use new operator to initialize an array

The best I can EXPLAIN: Array can be initialized using both new and COMMA separated expressions surrounded by curly BRACES example : int arr[5] = new int[5]; and int arr[] = { 0, 1, 2, 3, 4};



Discussion

No Comment Found

Related InterviewSolutions