Nama:Gaguh Sukma W
NIM:2012420019
public class BOLAoverridding {
String
nama,posisi,club;
void nama(){
System.out.println("Nama pemain Profesional");
}
void posisi(){
System.out.println("===========================");
}
void club(){
System.out.println("===========================");
}
}
class barca extends BOLAoverridding{
@Override
void nama(){
nama="Xavi
Hernandes";
System.out.println("Nama :"+nama);
}
@Override
void posisi(){
posisi="Gelandang";
System.out.println("posisi :"+posisi);
}
@Override
void club(){
club="Barselona";
System.out.println("Club :"+club+"\n");
}
}
class manchester
extends BOLAoverridding{
@Override
void nama(){
nama="Ryan Gigs";
System.out.println("Nama :"+nama);
}
@Override
void posisi(){
posisi="Gelandang";
System.out.println("Posisi :"+posisi);
}
@Override
void club (){
club="Manchester United";
System.out.println("Club :"+club+"\n");
}
}
class
persebaya extends BOLAoverridding{
@Override
void nama(){
nama="M Taufiq";
System.out.println("Nama :"+nama);
}
@Override
void posisi(){
posisi="Gelandang";
System.out.println("Posisi :"+posisi);
}
@Override
void club (){
club="Persebaya 1927";
System.out.println("Club :"+club+"\n");
}
public static void
main(String[] args) {
BOLAoverridding a=new BOLAoverridding();
barca b =new
barca();
manchester c
=new manchester();
persebaya d
=new persebaya();
a.nama();
a.posisi();
a.club();
b.nama();
b.posisi();
b.club();
c.nama();
c.posisi();
c.club();
d.nama();
d.posisi();
d.club();
}
}
===output===
Posted by 07.59 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar