abstract class abstract_superheo {
abstract void nama ();
abstract void kekuatan ();
abstract void kelemahan ();
}
class spidermanabstract extends abstract_superheo{
@Override
void nama (){
System.out.println("nama = spiderman");
}
@Override
void kekuatan (){
System.out.println("kekuatan = mempunyai gen laba-laba");
}
@Override
void kelemahan (){
System.out.println("kekuatan = obat serangga");
}
}
class catwomanabstract extends abstract_superheo{
@Override
void nama (){
System.out.println("nama = catwoman");
}
@Override
void kekuatan () {
System.out.println("kekuatan = kecepatan lebih");
}
@Override
void kelemahan () {
System.out.println("kelemahan = anjing buldog");
}
}
class supermanabstract extends abstract_superheo{
@Override
void nama (){
System.out.println("nama = superman");
}
@Override
void kekuatan () {
System.out.println("kekuatan = bisa terbang ");
}
@Override
void kelemahan () {
System.out.println("kelemahan = cripton net");
}
public static void main(String[] args) {
spidermanabstract a=new spidermanabstract();
catwomanabstract b=new catwomanabstract();
supermanabstract c=new supermanabstract();
a.nama();
a.kekuatan();
a.kelemahan();
System.out.println("===========================");
b.nama();
b.kekuatan();
b.kelemahan();
System.out.println("===========================");
c.nama();
c.kekuatan();
c.kelemahan();
}
}
Posted by 12.57 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar