abstract class faisol islami 2012420121
package tugas2;
/**
*
* @author user
*/
abstract class mantanAbstrak {
public String nama ;
public String suku ;
public int LamaPacaran ;
public void Perempuan (){
System.out.println("jenis kelaminnya perempuan");
}
abstract void namaMantan ();
abstract void suku();
abstract void lamapacaran ();
}
class abstrakMantan1 extends mantanAbstrak {
@Override
void namaMantan() {
nama = "Bunga";
System.out.println("nama mantan pertama adalah "+ nama);
}
@Override
void suku() {
suku = "madura";
System.out.println("dia bersuku "+suku);
}
@Override
void lamapacaran() {
LamaPacaran = 24 ;
System.out.println("Lama pacaran : "+LamaPacaran+" bulan");
}
}
class abstrakMantan2 extends mantanAbstrak {
@Override
void namaMantan() {
nama = "Citra";
System.out.println("Nama mantan ke-dua adalah "+nama);
}
@Override
void suku() {
suku = "jawa";
System.out.println("dia bersuku "+suku);
}
@Override
void lamapacaran() {
LamaPacaran = 18;
System.out.println("lama pacaran : "+LamaPacaran+ " bulan");
}
}
class abstrakMantan3 extends mantanAbstrak {
@Override
void namaMantan() {
nama = "Lestari" ;
System.out.println("Nama mantan ke-3 adalah "+nama);
}
@Override
void suku() {
suku = "jawa";
System.out.println("dia bersuku "+suku);
}
@Override
void lamapacaran() {
LamaPacaran = 3;
System.out.println("Lama pacaran : "+LamaPacaran+ " bulan");
}
public static void main(String[] args) {
abstrakMantan1 m = new abstrakMantan1();
m.namaMantan();
m.suku();
m.lamapacaran();
abstrakMantan2 n = new abstrakMantan2();
System.out.println("==============\n");
n.namaMantan();
n.suku();
n.lamapacaran();
abstrakMantan3 o = new abstrakMantan3();
System.out.println("==============\n");
o.namaMantan();
o.suku();
o.lamapacaran();
System.out.println("================");
}
}
Posted by 07.57 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar