what is the difference between these 2 array staments in java. In Statement 1 we dont use new keyword so my question is there object is created or not.
Statement 1: int[] arr = {10,20,30};
Statement 2: int[] arr = new int[]{10,20,30};
what is the difference between these 2 array staments in java. In Statement 1 we dont use new keyword so my question is there object is created or not.
Statement 1: int[] arr = {10,20,30};
Statement 2: int[] arr = new int[]{10,20,30};
Both are the same, just a different way of writing: