A

Admin • 832.27K Points
Coach

Q. Which of the following arrays is correctly initialized with values?

  • (A) int[] a = new int[3]{1,2,3};
  • (B) int a[] = {1,2,3};
  • (C) int a[3] = {1,2,3};
  • (D) int a() = new int[]{1,2,3};
  • Correct Answer - Option(B)
  • Views: 19
  • Filed under category Java
  • Hashtags: Java Array

Explanation by: Admin
Only option B is valid syntax for array declaration with initialization.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.