com.sun.source.tree

## Interface MethodTree

- All Superinterfaces:
    Tree

      @Exported
      public interface MethodTree
      extends Tree

  A tree node for a method or annotation type element declaration. For example:

         modifiers typeParameters type name
            ( parameters )
            body

         modifiers type name () default defaultValue

  Since:
    1.6
  See The Java™ Language Specification:
    sections 8.4, 8.6, 8.7, 9.4, and 9.6

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.sun.source.tree.Tree

      `Tree.Kind`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `BlockTree` | `getBody()` |
    `Tree` | `getDefaultValue()` |
    `ModifiersTree` | `getModifiers()` |
    `Name` | `getName()` |
    `List<? extends VariableTree>` | `getParameters()` |
    `VariableTree` | `getReceiverParameter()` | Return an explicit receiver parameter ("this" parameter).
    `Tree` | `getReturnType()` |
    `List<? extends ExpressionTree>` | `getThrows()` |
    `List<? extends TypeParameterTree>` | `getTypeParameters()` |

    - ### Methods inherited from interface com.sun.source.tree.Tree

      `accept, getKind`

- - ### Method Detail

    - #### getModifiers

          ModifiersTree getModifiers()

    - #### getName

          Name getName()

    - #### getReturnType

          Tree getReturnType()

    - #### getTypeParameters

          List<? extends TypeParameterTree> getTypeParameters()

    - #### getParameters

          List<? extends VariableTree> getParameters()

    - #### getReceiverParameter

          VariableTree getReceiverParameter()

      Return an explicit receiver parameter ("this" parameter).
      Returns:
        an explicit receiver parameter ("this" parameter)
      Since:
        1.8

    - #### getThrows

          List<? extends ExpressionTree> getThrows()

    - #### getBody

          BlockTree getBody()

    - #### getDefaultValue

          Tree getDefaultValue()

Copyright © 2005, 2026, Oracle and/or its affiliates. All rights reserved.