Pengertian Package adalah koleksi dari beberapa class dan interface yang saling berhubungan.
Contoh program :
Gapok.java
package PegawaiTetap ;
public class Gapok {
public void Gol (String Golongan) {
System.out.println(“Golongan = “+Golongan);
}
public void masa (int mskerja) {
System.out.println(“masakerja = “+masakerja);
}
public void GjPokok (int GPokok) {
System.out.println(“Gajipokok = “+GPokok);
}
}
Tunjangan.java
package PegawaiTetap ;
public class Tunjangan {
public void Tunjkel (int Tkel) {
System.out.println(“Tunjkeluarga = “+Tkel);
}
public void TunjJbt (int Tjbt) {
System.out.println(“TunjJabatan = “+Tjbt);
}
}
Honor.java
package Honorer ;
public class Honor {
public void Honortetap(int Hnrtetap) {
System.out.println(“Honor tetap = “+HnrTetap);
}
}
Lembur.java
package Honorer ;
public class Honor {
public void Honortetap(int Hnrtetap) {
System.out.println(“Honor tetap = “+HnrTetap);
}
Tespackage.java
Import PegawaiTetap ;
Import Honorer ;
public class Tespackage {
public static void main (String args [ ] ) {
Gapok objekGapok = new Gapok ( );
objekGapok.Gol (“3A”);
objekGapok.Masa ( 3 );
objekGapok.GjPokok ( 1800000 );
Tunjangan objekTunjangan = new Tunjangan ( );
objekTunjangan.Tunjkel ( 500000 );
objekTunjangan.Tunjjbt ( 800000 );
Honor objekHonor = new Honor ( );
objekHonor.HonorTetap ( 600000 );
Lembur objekLembur = new Lembur ( );
objekLembur.JmlLembur ( 10 );
}
}
Jumat, 12 Juni 2009
Langganan:
Posting Komentar (Atom)
kok honor.java sama lembur.java sama sih?
BalasHapus