Is an array an object in Java?

前端 未结 12 1880
我寻月下人不归
我寻月下人不归 2020-11-22 14:26

In Java we can declare an array using the following:

String[] array = new String[10]; 
int size = array.length; 

Does this mean that the arra

12条回答
  •  臣服心动
    2020-11-22 14:54

    Every array in java is an object ex int[] a=new int [2]; So new is used to create an object and as it is an object we can check the class name just using a.getClass().getName();

提交回复
热议问题