inheritence 3


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package program;

/**
 *
 * @author Administrator
 */
class mobill{
    //variabel instan
    private String warna;
    private int tahunPro;
    //konstruktor
    public mobill(String warna,int tahunPro){
        this.warna=warna;
        this.tahunPro=tahunPro;
    }
    //metode
    public void infow(){
        System.out.println("warna mobil   = "+this.warna);
        System.out.println("tahun produksi= "+this.tahunPro);
    }
}
public class Konstruktor116 {
    public static void main(String[] args) {
        mobill mbl = new mobill("kuning", 2005);
        mbl.infow();
    }
}

0 komentar:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | SharePoint Demo