This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Pages

Jumat, 04 April 2014

Contoh Abstrak Class

[quote]abstract class seniman{
        seniman(){
                System.out.println("Seniman ");
        }
        seniman (int a){
                System.out.println("Seniman dengan nilai "+a);
        }
        abstract void berkesenian();
       
        void tidur(){
                System.out.println("Zzzzzz...ZZZ...");
        }
        void makan(){
                System.out.println("Nyam....Nyam..");
        }
}
class pelukis extends seniman{
        pelukis(){
                super(2);
                System.out.println("pelukis");
        }
        void berkesenian(){
                System.out.println("Tap...Tap..tuk...tuk..");
        }      
        void berkessenian(int a){
        }
        void tidur(){
                System.out.println("Buzz..Nging...nging...brr..!!");
        }
}
class penyanyi extends seniman{
        void penyanyi(){
                System.out.println("penyanyi");
        }
        void berkesenian(){
                super.makan();
                System.out.println("Tralala..Trilili...!!1");
        }
        void bergumam(){
                System.out.println("Mmmm...mmm...");
        }
        static void suara(){
                System.out.println("Dududu....Dadada...");
        }
}

class quizutama{
        public static void main(String[]args){
                seniman ref;
               
                pelukis obj1 = new pelukis();

                ref = obj1;

                ref.berkesenian();
                ref.makan();
                ref.tidur();

               

                penyanyi obj2 = new penyanyi();
                ref = obj2;
                obj2.berkesenian();

                obj2.bergumam();
                penyanyi.suara();


                obj2.tidur();
        }
}[/quote]