B. int ages[]; ages[] = new int[12]:

This is the correct way to initialize an integer array named 'ages' with a size of 12 in Java. Here's a breakdown:

  • int ages[]; declares an integer array named 'ages'.
  • ages[] = new int[12]; allocates memory for 12 integer elements in the array.
Correct Statement for Array Initialization in Java

原文地址: https://www.cveoy.top/t/topic/ozZz 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录