Netbeans auto complete shortcuts you must know

Netbeans which I think is very user friendly editor and provides some great auto complete shortcuts which helps you to type less and save time. I would like to share some of these auto complete short cut words for netbeans editor when used to edit Java program.

Netbeans keyboard shortcuts


1. sout

When you type sout and press tab, then it is converted into system out println as shown below :


sout

System.out.println("");


Similarly if you try soutv and tab as shown below it helps quite a lot :


String text = "";
soutv
System.out.println("text = " + text);


Similarly you can use serr for printing errors as follows
serr
System.err.println ("|");


2. runn creating runnable object


runn
Runnable runnable = new Runnable() {

            public void run() {
                
            }
};
3. for loop

We can have different types of for loop, so for each one of those we can use following shortcuts along with tab.


for  // Press tab
for (int i = 0; i < 10; i++) {
}

forc

for (Iterator it = col.iterator(); it.hasNext();) {
            Object object = it.next();
            
        }

fore
for (Object elem : iterable) {
}

forv

for (int i = 0; i < vct.size(); i++) {
                Object object = vct.elementAt(i);
            }


Note : Similarly you can try with forst, forl and fori.



4. While loop

We can have different types of while loop, so for each one of those we can use following shortcuts along with tab.


wh  //Press tab 
while (true) {
            
}

whilexp 
while (exp) {}

whileit
while (it.hasNext()) {
   Object elem = (Object) it.next();}

dowhile
do {
} while (condition);


Note : Similarly you can try with whilen



5 psvm

This is also one of the important shortcut we offen need it converts psvm as follows :
psvm
public static void main(String[] args) {
}

Similarly you can use following shortcuts as well
psf   private static final
psfb  private static final boolean
psfi  private static final int
psfs  private static final String




6. Creating new object

For creating new object we can use newo as follows
newo 
Object name = new Object(args); 


7. Exception Handling
For exception handling we can use some of the shortcuts as follows :


trycatch
try {}
catch (Exception e) {}

tw 
throw

twn
 throw new

ca
catch(


fy
finally{
}



8. Access Modifiers

Here are some access modifiers

pu public
pe protected
pr private



9 . instance of


iof
instanceof


inst
 if (exp instanceof Object) {
Object obj = (Object) exp;


10 : Miscellaneous

Here are some shortcuts which you need to type and press tab key , shortcuts and its use as follows :

db  double
fl float
bo boolean

br break;
cl class
cn continue

df  default:
eq equals

ex extends
im implements
ir import

fa false

fi final
sy synchronized

su super


Thus just you need to type the shortcut and press tab, this will save lot of time.
Hope you like this list of shortcuts, if you like please consider sharing it.
Share on Google Plus

About Pranav

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

1 comments: