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

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 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[];

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Java Software Solutions

ISBN: 9789353063610

9th Edition

Authors: John Lewis, William Loftus

Question Posted: