For some reason I am having a very difficult time trying to initialize and store values in arrays within a constructor. When I use the debugger to check the arrays values, the Boolean all default to false and my other double array all default to 0s.
Pretend I have this:
public class shank { double h; double m; boolean t1; boolean t2; boolean t3; boolean t4; int peeps; double [] huy = new double [3]; boolean [] rup = new boolean [3]; shank(int popes, boolean r1; boolean r2; boolean r3; boolean r4) // two of these are true and 2 are false (boolean) { peeps = popes; t1 = r1; t2 = r2; t3 = r3; t4 = r4; double [] huy = {586.1, 429.3, 392.3, 3492.3}; //this defaults to all 0s. boolean [] rup = {t1, t2, t3, t4}; //this defaults to all false. } }
I figured the arrays default because I declare them twice, but if I don't, then I just get an error...Can someone direct me the correct way of getting my arrays correctly initialized. I should mention that I have two classes, one is the tester and this is the class that is called with the methods. I prefer that no more parameters be added to the constructor.