10 Useful NetBeans IDE Java Shortcuts

1. Type "fcom" (without the quotes, same as all the rest below) and then press Tab. You now have this, i.e., a brand new code fold:
// 
// 
2. Type "bcom" and then press Tab to create the start of a new set of comments in your code:
/**/
3. Type "runn" and press Tab and you'll have all of this:
Runnable runnable = new Runnable() {

    public void run() {

    }
};
4. If I have this:
String something = "";
...and then below that type "forst" and press Tab, I now have this:
String something = "";
for (StringTokenizer stringTokenizer = new StringTokenizer(something); stringTokenizer.hasMoreTokens();) {
    String token = stringTokenizer.nextToken();

}
Also, experiment with "forc", "fore", "fori", "forl", and "forv"!
5. I always knew that "sout" turns into "System.out.println("");" but did you know that (again assuming you first have a string something like above) if you type "soutv" you end up with this:
System.out.println("something = " + something);
Thanks Tom Wheeler for this tip.
6. Next, here are the new shortcuts that are new from NetBeans IDE 6.9 onwards:
as - assert=true;
su - super
db - double
sh - short
na - native
tr - transient
vo - volatile

7. I knew that "ifelse" would resolve to an if/else block. But did you know that if you don't need an 'else', you can simply type "iff", press Tab, and then end up with this:
if (exp) {

}
8. From NetBeans IDE 6.9 onwards, the "sw" shortcut expands to the following:
switch (var) {
    case val:

        break;
    default:
        throw new AssertionError();
}
9. If you're using while loops, experiment with "whileit", "whilen", and "whilexp".
10. Always remember these: "im" expands to "implements; "ex" to "extends".

Reblog from : http://netbeans.dzone.com/top-10-interesting-netbeans-shortcuts

Menghitung Selisih Waktu dengan JAVA (OOP)

Postingan kali ini Menghitung Selisih Waktu dengan JAVA (OOP) akan menunjukkan contoh aplikasi berbasis java untuk menghitung selisih antara 2 waktu dengan menggunakan pendekatan objek atau biasa disebut OOP (Object oriented programming).

1. Ini merupakan class yang memiliki main method di dalamnya

2. Ini merupakan class utama untuk membandingkan 2 waktu dan menghitung selisihnya.

Membuat Konversi Suhu dengan Java (OOP)

Kali ini saya akan memberikan contoh aplikasi sederhana untuk menghitung konversi suhu dengan menggunakan Java dengan menggunakan pendekatan OOP Aplikasi kali ini terdiri dari 5 class. 1 class sebagai main dan yang lain sebagai kalkulator suhu.
Baiklah langsung saja, simak source code di bawah:
1. Ini merupakan class utama yang memiliki main method di dalamnya

2. Ini merupakan class Celcius sebagai "kalkulator" suhu yang berasal dari celcius

3. Ini merupakan class Fahrenheit sebagai "kalkulator" suhu yang berasal dari fahrenheit

4. Ini merupakan class Kelvin sebagai "kalkulator" suhu yang berasal dari kelvin

5. Ini merupakan class Reamur sebagai "kalkulator" suhu yang berasal dari reamur