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.
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 ("|");
runn
Runnable runnable = new Runnable() {
public void run() {
}
};
![]()
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.
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
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
For creating new object we can use newo as follows
newo Object name = new Object(args);
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{
}
Here are some access modifiers
pu public pe protected pr private
iof
instanceof
inst
if (exp instanceof Object) {
Object obj = (Object) exp;
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.
