Nama : ACHMAD IRWANTO
NIK : 2012420031
KELAS : PAGI
Postingan kali ini yakni tentang konsep interface pada java..
Objek yang saya gunakan ialah "kampus"...
public interface kampus {
}
interface teknik{
void dekan();
void dosen();
void mhs();
}
interface hukum{
void dekan1();
void dosen1();
void mhs1();
}
interface sastra{
void dekan2();
void dosen2();
void mhs2();
}
class cak implements teknik,hukum,sastra{
@Override
public void dekan() {
System.out.println("~~~FAKULTAS TEKNIK~~~");
System.out.println("dekan = safrin");
}
@Override
public void dosen() {
System.out.println("dosen = vega");
}
@Override
public void mhs() {
System.out.println("mahasiswa = irwan");
}
@Override
public void dekan1() {
System.out.println("~~~FAKULTAS HUKUM~~~");
System.out.println("dekan = tukiyem");
}
@Override
public void dosen1() {
System.out.println("dosen = paijo");
}
@Override
public void mhs1() {
System.out.println("mahasiswa = reny");
}
@Override
public void dekan2() {
System.out.println("~~~FAKULTAS SASTRA~~~");
System.out.println("dekan = sarinem");
}
@Override
public void dosen2() {
System.out.println("dosen = bejo");
}
@Override
public void mhs2() {
System.out.println("mahasiswa = gopir"); }
}
class main{
public static void main(String[] args) {
cak i = new cak ();
i.dekan();
i.dosen();
i.mhs();
System.out.println("");
i.dekan1();
i.dosen1();
i.mhs1();
System.out.println("");
i.dekan2();
i.dosen2();
i.mhs2();
}
}
OUTPUTNYA :
Posted by 13.41 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar