If arrays are objects in Java then why they are not initialized using syntax X x = new X();
?
Like if there is a class named Person
, and I have to create an object of that class then I will use syntax: Person p1 = new Person();
. So why we don't declare arrays in the same way?
Please explain, arrays should be initialize using that syntax.