In java, arrays can be created as int[] arr = {value1, value2, value3,.....}. Here we are not using the "new" keyword.So how do we say that array is an object in java?
2 Answers
The Java language specification says so (http://docs.oracle.com/javase/specs/jls/se7/html/jls-10.html):
In the Java programming language, arrays are objects (§4.3.1), are dynamically created, and may be assigned to variables of type Object (§4.3.2). All methods of class Object may be invoked on an array.
String a = "b";and don't have to doString a = new String("b");andais still an object, the array is declared and initialized with a literal withoutnewand is still an object.classobjects are really objects, which I hate, but I suppose it does clear up ambiguity when talking about a language like Java in everyday terms.newkeyword likeint[] ints = new int[10];