>>super class
package Anjing_haci;
/**
*
* @figuhae
*/
public interface Anjing {
public void prilaku();
}
>>sub class
package Anjing_haci;
/**
*
* @figuhae
*/
public class makan implements Anjing{
@Override
public void prilaku(){
System.out.println("hachi sedang makan sambil berdiri or sambil duduk");
}
}
>>sub class
package Anjing_haci;
/**
*
* @figuhae
*/
public class nyokot implements Anjing {
@Override
public void prilaku(){
System.out.println("hachi sedang : nyokot, nyakar, ngodak");
}
}
>>>sub classs
package Anjing_haci;
/**
*
* @figuhae
*/
public class suara implements Anjing{
@Override
public void prilaku (){
System.out.println("suara hachi guk guk guk guk, auukkkkkk hukkkkkk");
}
}
method main
package Anjing_haci;
/**
*
* @figuhae
*/
public class Tunjukanaksimu {
public static void main(String[] args) {
nyokot a=new nyokot();
suara b=new suara();
makan c=new makan();
a.prilaku();
b.prilaku();
c.prilaku();
}
}
Posted by 01.05 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar