You can define a variable and its type in a comment. The comment has to be in the format /* @var $variable type */ . If the comment is written correctly, the var tag is in bold font.
You can use the code template vdoc, followed by Tab, to generate a comment that defines a variable. The variable name is selected, and you can change it. Then press Tab again, and the type is selected.
The code template automatically sets the variable name and type. If a variable is used after the place where you insert the template, then that following variable name is suggested by default. If there is not any variable used after the place where you insert the template, but there is a variable used above the template, then that preceeding variable name is suggested as default. If NetBeans IDE is not able locate any variable near where you use the template, then the default name is variable. The variable type is set automatically according to the same rules.
For more information, see the