2012420079
POLIMORFISME
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author analita
*/
public class musik {
String nama;
String aliran;
String lagu;
void youman() {
System.out.println("");
}
}
class kotak extends musik{
void Nama(){
System.out.println("nama="+nama);
}
void Aliran(){
System.out.println("Aliran="+aliran);
}
void Lagu(){
System.out.println("lagu="+lagu);
}
}
class armada extends musik{
void Nama(){
System.out.println("nama="+nama);
}
void Aliran(){
System.out.println("Aliran="+aliran);
}
void Lagu(){
System.out.println("lagu="+lagu);
}
}
class st12 extends musik{
void Nama(){
System.out.println("nama="+nama);
}
void Aliran(){
System.out.println("Aliran="+aliran);
}
void Lagu(){
System.out.println("lagu="+lagu);
}
public static void main(String[] args) {
musik x= new musik();
kotak m= new kotak();
m.nama="kotak";
m.aliran="rock";
m.lagu="beraksi";
m.Nama();
m.Aliran();
m.Lagu();
System.out.println("===========");
armada n=new armada();
n.nama="armada";
n.aliran="pop";
n.lagu="buka hatimu";
n.Nama();
n.Aliran();
n.Lagu();
System.out.println("============");
st12 l=new st12();
l.nama="st12";
l.aliran="melayu";
l.lagu="cari pacar lagi";
l.Nama();
l.Aliran();
l.Lagu();
System.out.println("=============");
}
}
Posted by 01.24 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar