title: The final local variable cannot be assigned, since it is defined in an enclosing type?
body: <p>Looking to be able to create a variable at the end that has a value for Time and Cost that I will display in an TextView eventually. Running into an issue with my ints though.</p>
  
  <pre><code>public class MainActivity extends Activity {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      final int intTime = 30;
      final int intCost = 10;
  
      CheckBox CP = (CheckBox)findViewById(R.id.checkPepperoni);
      CheckBox CS = (CheckBox)findViewById(R.id.checkSausage);
      CheckBox CB = (CheckBox)findViewById(R.id.checkBacon);
      CheckBox CM = (CheckBox)findViewById(R.id.checkMushroom);
  
      final ImageView cheese =(ImageView)findViewById(R.id.imgCheese);
      final ImageView pepperoni =(ImageView)findViewById(R.id.imgPepperoni);
      final ImageView sausage =(ImageView)findViewById(R.id.imgSausage);
      final ImageView bacon =(ImageView)findViewById(R.id.imgBacon);
      final ImageView mushroom =(ImageView)findViewById(R.id.imgMushroom);
  
      final SharedPreferences sharedPref =PreferenceManager.getDefaultSharedPreferences(this);
  
  
  
      CP.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
                          //Pepperoni Listener
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked1) {
              // TODO Auto-generated method stub
  
                    if(isChecked1){                       
  
                        pepperoni.setImageResource(R.drawable.pepperoni);
                        intTime = intTime + 6;
                        intCost = intCost + 5;
                      }
                     else{
  
                          pepperoni.setImageResource(0);
                          intTime = intTime - 6;
                          intCost = intCost - 5;
                     }
  
      }});
  
      CS.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
                      //Sausage Listener
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked2) {
              // TODO Auto-generated method stub
  
                    if(isChecked2){                       
  
                        sausage.setImageResource(R.drawable.sausage);
                        intTime = intTime + 6;
                        intCost = intCost + 5;
  
                      }
                     else{
  
                         sausage.setImageResource(0);
                         intTime = intTime - 6;
                          intCost = intCost - 5;
  
                     }
  
      }});
  
      CB.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked3) {
              // TODO Auto-generated method stub
  
                    if(isChecked3){                       
  
                        bacon.setImageResource(R.drawable.bacon);
                        intTime = intTime + 6;
                        intCost = intCost + 5;
  
                      }
                     else{
  
                         bacon.setImageResource(0);
                         intTime = intTime - 6;
                          intCost = intCost - 5;
  
                     }
  
      }});
  
      CM.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked4) {
              // TODO Auto-generated method stub
  
                    if(isChecked4){                       
  
                        mushroom.setImageResource(R.drawable.mushroom);
                        intTime = intTime + 6;
                        intCost = intCost + 5;
  
                      }
                     else{
  
                         mushroom.setImageResource(0);
                         intTime = intTime - 6;
                          intCost = intCost - 5;
  
                     }
  
      }});
  
  
      ImageButton IB = (ImageButton)findViewById(R.id.imgBtnGo);
      IB.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View v) {
              // TODO Auto-generated method stub
              String time = Integer.toString(intTime);
              String cost = Integer.toString(intCost);
  
              SharedPreferences.Editor editor = sharedPref.edit();
              editor.putString("keyTime", time);
              editor.putString("keyCost", cost);
  
              startActivity(new Intent(MainActivity.this, ResultActivity.class));
  
          }
  
      });
  }
  
  }
  </code></pre>
  
  <p>The error I'm running into is, "The final local variable intCost cannot be assigned, since it is defined in an enclosing type."</p>
  
  <p>What does this mean, and is there any way that I'd be able to change this variable using all of the checkboxes?</p>