16 Januari, 2010

Meng-extends Class vs. Implementasi interface

       Sebuah class hanya bisa meng-EXTENDS SATU superclass, tetapi juga bisa meng-IMPLEMENTASIKAN BANYAK interface
       Sebagai contoh:       
public class Person implements PersonInterface,
                        LivingThing,
                        WhateverInterface {
   //beberapa kode disini
}

       Contoh lain:
public class ComputerScienceStudent extends Student
                        implements PersonInterface,
                                  LivingThing {
   //Beberapa kode disini
}




0 komentar:

Posting Komentar