Answer the question
In order to leave comments, you need to log in
Question about arrays in Java, and understanding the difference between C++ and Java?
Integer[] arr = new Integer[5];
Integer arr1[];
Is there any difference between these arrays? I used to study C++ and I'm not used to the syntax of the first array, because this is how C++ allocated memory for a dynamic array. Does Java allocate dynamic memory for all arrays? C++ is a static language and Java is OOP, but I don't fully understand the difference between the two. OOP has classes, although C++ also has classes. In short, I am very confused. Help.
Answer the question
In order to leave comments, you need to log in
Integer[] arr = new Integer[5]; // так вы объявляете массив длинной 5 элементов.
Integer[] arr1; // переменная arr1 объявлена, но не инициализирована.
Integer[] arr;
arr = new Integer[5];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question