?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Moderate

Data Type Defaults

APCSA-VVLF6E

What are the default values for the String, int, double, and boolean data types when creating an array, as follows, of each of these data types?

String[] words = new String[10];
int[] nums = new int[10];
double[] cost = new double[10];
boolean[] passing = new boolean[10];
A

String defaults to "" (empty string), int defaults to 0, double defaults to 0.0, boolean defaults to false.

B

String defaults to null, int defaults to 0, double defaults to 0.0, boolean defaults to false.

C

String defaults to "" (empty string), int defaults to 0, double defaults to 0.0, boolean defaults to true.

D

String defaults to null, int defaults to 0, double defaults to 0.0, boolean defaults to true.

E

String defaults to space, int defaults to 0, double defaults to 0.0, boolean defaults to true.