title: How to stop/exit a sub-classed method execution from its super class method in java
body: <p>Given the below snippet:</p>
  
  <p>Super Class implementation:</p>
  
  <pre><code>@Override
      public void onDone(String taskName, JSONObject receivedData, @Nullable HashMap&lt;String, String&gt; sentData) {
          //checks the status for all done process decides to call the presenter failed or success
          try {
              boolean success = receivedData.getString("status").equals("success");
              if(!success){
                  this.presenter.error(receivedData.getString("reason"));
              }
          }catch (JSONException ex){
              ex.printStackTrace();
              this.presenter.error("An error occurred");
          }
      }
  </code></pre>
  
  <p>Sub-Class Implementation::</p>
  
  <pre><code>@Override
      public void onDone(@NonNull String taskName, @NonNull JSONObject receivedData,
                         @Nullable HashMap&lt;String, String&gt; sentData) {
          super.onDone(taskName, receivedData, sentData);
          //the expected data has been received we should act upon it
          //this DAO should know all the type of taskName it can handle and if it finds any that doesn't
          //matches any of its command let it exit
          Log.e(TAG, "Response : "+receivedData);
          Toast.makeText(this.presenter.getContext(), "Done with task", Toast.LENGTH_LONG).show();
          if(sentData!=null){
              sentData.clear();
              sentData = null;
          }
      }
  </code></pre>
  
  <p>What i want is that as soon as the <strong>super.onDone</strong> method detects an error, the process should end there and shouldn't bother running the body of the sub class method, is that possible in JAVA?</p>