title: How to exit as Sub in Java
body: <p>In VB you would create this code:</p>
  
  <pre><code>Sub doitnow()
  dim a = 1
     for a = 1 to 45
      if a = 5
        exit sub
      end if
      a = a +1
     next a
  end sub
  </code></pre>
  
  <p>In Java how do you exit early? I have a program with settings and diferent ways to enter the program and if you enter without having the settings done, I wish to stop the activity and send them to the settings activity.</p>
  
  <p>Currently I have:</p>
  
  <pre><code>try {
    Ls = new LoadSettings(Add.this);
    gs = new GlobalSubs();
  } catch (Exception e) {
    Intent c = new Intent(this, Preferences.class);
    finish();
    startActivity(c);
  }
  </code></pre>
  
  <p>But the same activity continues and does not stop creating a force stop error.</p>