This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

Selasa, 06 Desember 2011

Pewarisan

 Pewarisan

Salah satu kelebihan pemrograman berorientasi Objek adalah penggunaan ulang kode-kode yang telah dibuat. Pewarisan adalah salah satu cara diantaranya.
Sebagai contoh, kelas Manusia diturunkan menjadi kelas Mahasiswa.


class Mahasiswa extends Manusia{
//konstruktor Mahasiswa
Mahasiswa(String n){
//memanggil konstruktor Manusia
super(n);
}
//method bentukan baru...
void kerja(){
System.out.println("belajar...belajar...");
}
}

Kelas dan Object

Kelas dan Object

Kelas dapat didefinisikan sebagai template/blue-print untuk membuat object. Kelas Pembuatan object dari kelas dikenal dengan nama instansiasi



Sebagai contoh, kita ambil kelas Manusia, mempunyai atribut nama. Selain itu, ia juga mempunyai method tampilkanNama , kerja, makan. Setiap kelas memiliki konstruktor yang berfungsi sebagai pembentuk object, ia juga berfungsi sebagai procedure yang pertama kali dijalankan ketika object bentukan terbentuk.