inheritence

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

package program;

/**
 *
 * @author Administrator
 */
class mobil{
    String warna;
    int tahunProduksi;
}
public class klassMobil166 {
    public static void main(String[] args) {
        mobil mbl= new mobil();
        mbl.warna="merah";
        mbl.tahunProduksi=2000;
        System.out.println("warna mobil "+mbl.warna);
        System.out.println("tahun prdk  "+mbl.tahunProduksi);
    }
}

hitung segitiga


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

package program;

import com.sun.org.apache.xml.internal.utils.StylesheetPIHandler;

/**
 *
 * @author Administrator
 */
public class hitungSegitiga166 {
    public static void main(String[] args) {
        modelSegitiga166 segi = new modelSegitiga166();
        segi.setAlas(20);
        segi.setTinggi(90);

        System.out.println("luas segitiga = "+segi.getLuas());
    }
}

float

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

package program;

/**
 *
 * @author Administrator
 */
public class float166 {
    public static void main(String[] args) {
        float bil1=0;
        float bil2=0.13f;
        float bil3=0.24f;

        System.out.println("float bil1 ="+bil1);
        System.out.println("float bil2 ="+bil2);
        System.out.println("float bil3 ="+bil3);
    }
}

class penento project


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

package program;

/**
 *
 * @author Administrator
 */
public class classPenentuProject {
    public static void main(String[] args) {
        carlie crl= new carlie();
        crl.info();

        delta del = new delta();
        del.info();
    }
}

class delta

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

package program;

/**
 *
 * @author Administrator
 */
class delta extends carlie{
    private int c=15;
    @Override
    public void info(){
        System.out.println("dipaggil pada " +
                this.getClass().getCanonicalName());
        System.out.println("nilai b = "+bb);
        System.out.println("nilai c = "+c);
    }
}
public class classDelta {

}

Twitter Delicious Facebook Digg Stumbleupon Favorites More

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