Code completion also works for variable types and method return values, for
example, if we want to declare a variable of type java.util.List , we simply need
to type the first few characters of the type, then hit Ctrl+space , NetBeans will try
to complete with types in any packages we have imported in our class. To make
NetBeans attempt to complete with any type in the CLASSPATH, we need to hit
As we can see in the above screenshot, NetBeans displays JavaDoc for the class we
selected from the code completion options. Another time-saving feature is that the
class we select from the options is automatically imported into our code.
Once we have the type of our variable, we can hit Ctrl+Space again right after the
variable and NetBeans will suggest variable names.