top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Which of the following Java statements about arrays is syntactically wrong? Expain

+1 vote
434 views
  1. arrayName[] p = new arrayName[5];
  2. arrayName p[5];
  3. arrayName[] p [];
  4. arrayName p[][] = new arrayName[2][];
posted Dec 21, 2016 by Ujjwal Mehra

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

When you are defining an array of constant size, you have to use new to allocate the memory at the same time else you will face error. As per my explanation, second statement is incorrect.

answer Dec 24, 2016 by Harshita
...