Explain arrays in Java. How does it differ from C++ ?
Answers
THE EXPLANATION OF JAVA ARRAY IS GIVEN ABOVE IN THE SHEET
the difference between in arrays in C++ and Java is that Java arrays are references ,like all non -primitive Java objects , while C++ arrays are not , like all C++ objects. Declaring an array in C++ allocates memory for the array.
_______________________________________________
PLS MARK IT AS THE BRAINLIEST IF YOU'RE SATISFIED WITH MY ANSWER.....:)
Answer:
Here is an array definition in Java and C++.
Explanation:
Array:
An array is a container object that holds a fixed number of values of a single type. The length of an array is established when the array is created. After creation, its length is fixed. You have seen an example of arrays already, in the main method of the "Hello World!" application.
Differences
- In Java, arrays are index-based; the first element of the array is kept at the 0th index, the second element at the 1st index, and so on. In contrast to C/C++, we may obtain the length of the array using the length member. The size of operator is required in C/C++. In Java, an array is a dynamically produced class object.
- An array is a variable in C++ that can hold numerous values of the same type. As an example, Assume we have 27 students in a class and we need to save their marks.
For more visit:
https://brainly.in/question/9763781
#SPJ3