Question: Which of the following are valid declarations? Which instantiate an array object? Explain your answers. int primes = {2, 3, 4, 5, 7, 11}; float

Which of the following are valid declarations? Which instantiate an array object? Explain your answers.

int primes = {2, 3, 4, 5, 7, 11};

float elapsedTimes[] = {11.47, 12.04, 11.72, 13.88};

int[] scores = int[30];

int[] primes = new {2,3,5,7,11};

int[] scores = new int[30];

char grades[] = {'a', 'b', 'c', 'd', 'f'};

char[] grades = new char[];

Step by Step Solution

3.53 Rating (163 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

int primes 2 3 4 5 7 11 Invalid an int cannot be declared and initialized using an intializer list T... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Software Solutions Questions!