nama : agy eka lesmana
kelas : 3ka16
npm : 10108122
1. SuperKelasKendaraan.java
class SuperKelasKendaraan{
pulic void methodAsli(){
string roda;
string stang;
string sadel;
System.out.println("Method milik SuperKelasKendaraanjalan");
}
public static void jalankan (String[]args){
SuperKelasKendaraanoks=new SuperKelasKendaraan();
oks.methodAsli();
}
void rem (String[]args){
SuperKendaraanoks=new SuperKelasKendaraan();
oks.methodAsli();
}
}
SubKelasMotor.java
class SubKelasMotor extends KelasKendaran{
public void methodAsli(){
System.out.println("method overrided jalan");
}
public void methodJumping(){
roda=2;
System.out.println("kendaraan ber-roda "+roda)
Super.methodAsli();
}
public static void main(String[]args){
Subkelas osk=new SubKelas();
osk.methodASli();
osk.merhodJumping();
}
}
SubKelasMobil.java
class SubKelasMobil extends KelasKendaran{
public void methodAsli(){
System.out.println("method overrided jalan");
}
public void methodMundur(){
roda=4;
System.out.println("kendaraan ber-roda "+roda)
Super.methodAsli();
}
public static void main(String[]args){
Subkelas osk=new SubKelas();
osk.methodASli();
osk.merhodMundur();
}
}
0 komentar:
Posting Komentar