title: Initializing array with values from constructor parameter - Impossible to initialize?
body: <p>I asked this same question on javaprogrammingforums.com but it seems their website is down right now. So I couldn't see what responses (if any) I got. Anyways, I am badly stuck on this Java HW assignment. What I have so far looks good in terms of completion, now it's just getting the right values to appear. Pretend I have this:</p>
  
  <p>(This is only part of the 2nd class of the two with the constructor, the other is the "tester")</p>
  
  <pre><code>//private variables
  boolean myP;
  boolean myPla;
  boolean myGl;
  boolean myCa;
  
  double myPlot;
  int myCrust;
  
  double myReduct;
  double myNet;
  double myGross;
  
  boolean [] trshIt = {myP, myPla, myGl, myCa};
  double [] CO2TrashEmissions = {184.0, 25.6, 46.6, 165.8};
  
  //constructor
  CO2FromWaste(int crust, boolean p, boolean pl, boolean gl, boolean ca)
  {
      myPlot = 1018.0;
      myCrust = crust;
      myP = p;
      myPl = pl;
      myGl = gl;
      myCa = ca;
  }
  </code></pre>
  
  <p>My issue is that boolean array, <strong>trshIt</strong>. Since I am putting variables in the array that have not been initialized yet, it gives those variables default values of false. If I put it in the constructor first, then I get an error complaining that the variable <strong>trshIt</strong> can not be found; pointing to the instance that I am calling that variable. So I have tried different forms of it in different areas and I am like trapped in a maze right now trying to get that array to work properly. I need all the help I can get. Ideas?</p>