how calculate java array memory usage

前端 未结 6 965
粉色の甜心
粉色の甜心 2020-12-03 03:42

If I have:

int c[] = new int[10];

and

int a[][] = new int[2][3];

and in generally

an n*m*..

6条回答
  •  北海茫月
    2020-12-03 04:29

    The int[] or int[][] is not a primitive data type. It is an Object in Java. And with an Object, the size cannot be calculated straight away.

提交回复
热议问题