Consider this declaration,]int arr = new int;
Since we use the 'new' operator - doesn't this mean, arr is an object?
Moreover arr.toString() inside System.out.println(), does not throw any error either!
In the Java programming language arrays are objects , are dynamically created, and may be assigned to variables of type Object . All methods of class Object may be invoked on an array.
int arr = new int;
here arr reference variable pointing to object of "Object" Class
An array object contains a number of variables. The number of variables may be zero, in which case the array is said to be empty. The variables contained in an array have no names; instead they are referenced by array access expressions that use nonnegative integer index values. These variables are called the components of the array. If an array has n components, we say n is the length of the array; the components of the array are referenced using integer indices from 0 to n-1, inclusive.
Attitude is everything
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database