title: Android Studio: @Override "Annotations are not allowed here"
body: <p>I want to implement the ...</p>
  
  <pre><code>@Override
      public void onBackPressed() {
       }
  </code></pre>
  
  <p>However, I get an error message saying, <strong>"Annotations are not allowed here"</strong>. I need this method to be implemented here. Is there an alternative?</p>
  
  <pre><code>public class supbreh extends Appbreh
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_intent_breh);
  
   if (myBundle != null) {
  
          String name =  myBundle.getString("workout");
          ShowDetails(name);
      }
  }
  
   private void ShowAbDetails(String mName) {
  
  
      if(mName.equals("abs1")){
  
  
          @Override
          public void onBackPressed() {  //"Not Allowed here"
  
          }
  
  }
  </code></pre>