title: Android Programming.Why is my line of coding unreachable
body: <p>I've been coding for a bit trying to link two <code>activties</code> and I'm nearly there but I've run into a problem.</p>
  
  <p>A line of my coding is unreachable. Can anyone explain why?</p>
  
  <pre><code>package com.example.twolink
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      getActionBar().setDisplayHomeAsUpEnabled(true);
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      getMenuInflater().inflate(R.menu.activity_main, menu);
      return true;
  }  
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      switch (item.getItemId()) {
          case android.R.id.home:
              NavUtils.navigateUpFromSameTask(this);
              return true;
      }
      return super.onOptionsItemSelected(item);
  
      Button button2 = (Button) findViewById(R.id.button2);
      button2.setOnClickListener(new OnClickListener() {          
          public void onClick(View v) {
              startActivity(new Intent(getApplicationContext(), MainActivity2.class));
              finish();
          }   
      });
  } 
  </code></pre>