How do I declare and initialize an array in Java?
Answers
Answered by
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
5
- 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
Math,
7 months ago
Business Studies,
7 months ago
Math,
7 months ago
Computer Science,
1 year ago
Science,
1 year ago
Hindi,
1 year ago
Math,
1 year ago