Declaring Array Variables in Java

ValuableDaisy avatar
ValuableDaisy
·
·
Download

Start Quiz

Study Flashcards

Questions and Answers

What is the syntax for declaring an array variable in Java?

dataType arrayName[];

What does an array in Java hold?

It holds data elements of the same type in a sequential fashion.

How can you initialize an array during declaration in Java?

int age[] = {12, 4, 5, 2, 5};

What does each memory location in a Java array have associated with it?

<p>Each memory location is associated with a number known as an array index.</p> Signup and view all the answers

Can you combine array declaration and memory allocation in Java?

<p>Yes, using int intArray[] = new int;</p> Signup and view all the answers

Use Quizgecko on...
Browser
Browser