Anda di halaman 1dari 1

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

*/ package mobil2; /** * * @author FTIK */ public class MobilKita { /** * @param args the command line arguments */ public static void main(String[] args) { Mobil2 mobilku = new Mobil2(); mobilku.isiVariabel("Merah",2010); mobilku.printMobil(); } // TODO code application logic here } Source code pada mainclass mobil2.java /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package mobil2; /** * * @author FTIK */ public class Mobil2 { /** * @param args the command line arguments */ String warna; int tahunProduksi; void isiVariabel(String warnaMobil, int tahunMobil){ warna=warnaMobil; tahunProduksi=tahunMobil; } void printMobil(){ System.out.println("Warna mobil:"+warna); System.out.println("Tahun Mobil:"+tahunProduksi); } // TODO code application logic here }

Anda mungkin juga menyukai