VariableTree (Compiler Tree API )
Keywords: com.sun.source.tree.VariableTree interface
Date: 2026-04-17

com.sun.source.tree

## Interface VariableTree

- All Superinterfaces:
    StatementTree, Tree

      @Exported
      public interface VariableTree
      extends StatementTree

  A tree node for a variable declaration. For example:

         modifiers type name initializer ;
         modifiers type qualified-name.this

  Since:
    1.6
  See The Java™ Language Specification:
    sections 8.3 and 14.4

- - ### 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 and Description
    --- | ---
    `ExpressionTree` | `getInitializer()`
    `ModifiersTree` | `getModifiers()`
    `Name` | `getName()`
    `ExpressionTree` | `getNameExpression()`
    `Tree` | `getType()`

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

      `accept, getKind`

- - ### Method Detail

    - #### getModifiers

          ModifiersTree getModifiers()

    - #### getName

          Name getName()

    - #### getNameExpression

          ExpressionTree getNameExpression()

    - #### getType

          Tree getType()

    - #### getInitializer

          ExpressionTree getInitializer()

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