+ 2
array
can anyone teach me array...
3 Answers
+ 5
Example of Java array
https://code.sololearn.com/cUKEWA8wZlN2/?ref=app
+ 3
Array is a user-defined datatype it means it a a datatype which is define by user in most of the language like C, C++, etc.
But not in Java java treat array as a class.Yup,array is a class in Java.So when we need an array we create it by creating as object with the help of new keyword.
Syntax:
<datatype> <array_name> = new <datatype>[<size>
Example:
int arr = new int[10];
There are also some predefined methods available in Array class like <array_name>.length().Its return length of the array as integer value.