//super class
class parent{int a = 5;}
//sub class
class child extends parent{
int a = 10;
void method(){
System.out.println(a);
}
}
//main class
class test{
public static void main(String[] s){
child c = new child();
c.method;
}
}
Aucun commentaire:
Enregistrer un commentaire