Computer Science, asked by thumcherlathiru6466, 1 year ago

How do I declare and initialize an array in Java?

Answers

Answered by beautygirll56
2

You can either use array declaration or array literal (but only when you declare and affect the variable right away, array literals cannot be used for re-assigning an array).


priyannsh: uske taraf se mein sorry bol rha hun
Answered by Anonymous
5

\huge{\underline{\underline{\huge{\bold{AnsweR \: :-}}}}}

  • Obtaining an array is a two-step process. First, you must declare a variable of the desired array type. Second, you must allocate the memory that will hold the array, using new, and assign it to the array variable. Thus, in Java all arrays are dynamically allocated.
Similar questions