How do you initialize an array in a constructor in Java?
How do you initialize an array in a constructor in Java? 6 Answers. private int[] data = new int[3]; This already initializes your array elements to 0. You don’t need to repeat that again in the constructor. Can we pass array in constructor? To pass an array to a constructor we need to pass in […]