# Implement methods of an interface or abstract class

If a class is declared as implementing a certain interface or extending a class with abstract methods , it has to implement the methods of such interface or class. IntelliJ IDEA creates stubs for implemented methods , with the default return values for the primitive types, and null values for the objects.

Procedure: Implement required methods

1. From the main menu, select `Code | Implement methods` or press `Ctrl+I` (Windows), `⌃ I` (macOS), `⌘ I` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ I` (macOS System Shortcuts), `Ctrl+I` (XWin), `Ctrl+I` (GNOME), `Ctrl+I` (KDE), `Ctrl+I` (Emacs), `Ctrl+I` (Sublime Text), `Ctrl+I` (Sublime Text (macOS)), `Ctrl+I` (NetBeans), `Ctrl+Shift+I` (Visual Studio), `⌃ I` (Visual Studio (macOS)), `Alt+Shift+P` (Eclipse), `Ctrl+I` (Eclipse (macOS)). You can also 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 Implement methods. Or put your cursor on the class and press `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `Alt+Enter` (NetBeans), `Alt+Enter` (Visual Studio), `⌥ ⏎` (Visual Studio (macOS)), `Ctrl+1` (Eclipse), `⌘ 1` (Eclipse (macOS)) and select Implement methods.

2. In the dialog that opens, select the methods to implement (hold the `Shift` or `Ctrl` key to perform a multi-selection). The list does not include the methods that are already implemented or cannot be accessed from the current class.   If necessary, select the Copy JavaDoc  checkbox to insert JavaDoc comments for the implemented methods .

![The Choose Methods to Implement dialog](https://resources.jetbrains.com/help/img/idea/2026.2/ij_choose_methods_to_implement.png)

3. Click OK.

## Change method body

The [code template](null) used for implementing methods (Implemented method body) accepts predefined template variables from the File Header include template (such as `${USER}`, `${DATE}`, and so on)

For example, consider the following file 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 implemented interface contains two methods, this template expands into the following code:

```JAVA
@Override
public void hunt() {
    // TODO (wombat, 9/21/12): To change the body of an implemented method, use File | Settings - Editor -  File and Code Templates.
}
@Override
public String sniff() {
    return null;  // TODO (wombat, 9/21/12): To change body of implemented methods use File | Settings - Editor - File and Code Templates.
}
```

Procedure: Configure nullability annotations

You can configure the [nullability annotations](annotating-source-code.html) for the generated code.

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Settings | Editor | Inspections | Probable Bugs | Nullability and data flow problems`.

2. Click Configure Annotations, then select the annotation in Annotation used for code generation.

