Multiple choice technology

To declare an array of 31 floating point numbers representing snowfall for each day of March in Gnome, Alaska, which declarations would be valid?

  1. double snow[] = new double[31];

  2. doublesnow[31] = new array[31];

  3. doublesnow[31] = new array;

  4. double[]snow = new double[31];

Reveal answer Fill a bubble to check yourself
A,D Correct answer
Explanation

Java supports multiple array declaration syntaxes. Option A (double snow[]) uses C-style declaration where brackets follow the variable name. Option D (double[] snow) uses standard Java style with brackets before the variable name. Both correctly allocate an array of 31 doubles using new double[31].