In c/c++, it is a must to specifiy a literal number of the array size when creating, i.e. int arr[10];. But in java, we can create an array in this form int size = 10; int[] arr = new int[size];. And the compiler will not figure out what actually the variable size is. Then how does jvm allocate the memeories the array needs ?