0

is object of array is created in memory when we create array like this int arr []={1,2,3};

as we know that object is created by help of new keyword in java so in case when create array like this....int arr []={1,2,3}; the object of array will be created or not???

2/11/2020 7:40:35 PM

Programmer</>

4 Answers

New Answer

0

//int[] arr = new int[] {1,2,3}; int[] arr = {1,2,3}; System.out.println( arr instanceof int[] ); // true System.out.println( arr instanceof Object ); // true System.out.println( arr.getClass() ); // class [I Object obj = (Object) arr; // ok

0

TheCoder | I Specialise in C# right bro but where it will create memory??i mean inside heap or emewhere else?? ...and how object would be created in heap in this case int arr []={1,2,3}; as we know that we fid not used new keyeord here

0

it is language simplification for some basic types to not use new keyword such as String s = "abc"; String st = new String("abc");