title: Why it says that "Cannot refer to a non-final variable i inside an inner class defined in a different method"?
body: <p>I have button click listener and in <code>onCreate()</code> method I have a local variable like</p>
  
  <pre><code> onCreate() {
  
   super.onCreate();
  
   int i = 10;
  
   Button button = (Button)findViewById(R.id.button);
  
   button.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View v) {
              i++;
          }   
      });
  </code></pre>
  
  <p>Why java asks for to make me final ?</p>