# Override methods of a superclass

You can override any method of a parent class by generating necessary code from a predefined template. IntelliJ IDEA creates a stub that contains a call to the method of the superclass, leaving the developer with the task of providing some meaningful source code in the method's body.

Procedure: Override a method of a superclass

1. On the `Code` menu, click `Override methods` `Ctrl+O` (Windows), `⌃ O` (macOS), `⌘ O` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ O` (macOS System Shortcuts), `Ctrl+O` (XWin), `Ctrl+O` (GNOME), `Ctrl+O` (KDE), `Ctrl+O` (Emacs), `Ctrl+O` (Sublime Text), `Ctrl+O` (Sublime Text (macOS)), `Ctrl+O` (NetBeans), `Ctrl+O` (Visual Studio), `Ctrl+O` (Visual Studio (macOS)), `Ctrl+O` (Eclipse), `Ctrl+O` (Eclipse (macOS)). Alternatively, you can right-click anywhere in the class file, then click Generate `Alt+Insert` (Windows), `⌘ N` (macOS), `⌃ N` (IntelliJ IDEA Classic (macOS)), `⌘ N` (macOS System Shortcuts), `Alt+Insert` (XWin), `Alt+Insert` (GNOME), `Alt+Insert` (KDE), `Alt+Insert` (Emacs), `Alt+Insert` (Sublime Text), `⌘ N` (Sublime Text (macOS)), `Alt+Insert` (NetBeans), `Alt+Insert` (Visual Studio), `⌘ ⌃ N` (Visual Studio (macOS)), `Alt+Insert` (Eclipse), `⌘ N` (Eclipse (macOS)), and select Override methods.

2. Select the methods to override (hold the `Shift` or `Ctrl` key to perform a multi-selection). The list does not include the methods that are already overridden or cannot be accessed from the current subclass.

![Select methods to override](https://resources.jetbrains.com/help/img/idea/2026.2/ij_overrideMethod.png)

If necessary, select the Copy JavaDoc checkbox to insert JavaDoc comments for the overridden methods.

If necessary, select the Insert @Override checkbox to insert the `@Override` annotation.

3. Click OK and provide the source code for the method body.

Hover over the ![Override](https://resources.jetbrains.com/help/img/idea/2026.2/app.expui.gutter.overridingMethod.svg) icon in the gutter to view the name of the base class. Click it to [open the overridden method declaration](navigating-through-the-source-code.html#go_to_implementation).

![Overriding method icon in the gutter](https://resources.jetbrains.com/help/img/idea/2026.2/overrideMethod1.png)

## Change the method body

The code template used for overriding methods (Overridden method body) accepts predefined template variables from the File Header include template (such as `${USER}`, `${DATE}`, and so on).

For example, consider the following code template:

```JAVA
#if ( $RETURN_TYPE != "void" )return $DEFAULT_RETURN_VALUE;#end
// TODO ($USER, $DATE):To change the body of an implemented method, use File | Settings - Editor -  File and Code Templates.
```

Provided that the overridden class contains two methods, this template expands into the following code:

```JAVA
public void breathe() {
    // TODO (wombat, 9/21/22): To change the method body, use Settings - Editor - File and Code Templates.
}

public void eat() {
    // TODO (wombat, 9/21/22): To change  the method body, use Settings - Editor - File and Code Templates.
}
```

