Tuesday 15 May 2012

java - How to pass int array as an argument to a constructor? -


Can anyone tell me whether it is possible to pass an integer array as a constructor's argument?

I have tried the following:

  public static zero main (string array []) {accumulator [] x = new accumulator [3]; } Public Accumulator (ant.) X) {A = new int [x long]; For (int i = 0; i  

You are starting an array of caches with size three in your main method Are there. / P>

To pass an integer head for the constructor's creator, you have to do something like:

  public static zero main (string algos []) {int [] SomeArray = {1,2,3}; Accumulative accumulator = new container (some other); } Public Accumulator (ant.) X) {A = new int [x long]; For (int i = 0; i  

No comments:

Post a Comment