class contieneth {
private int a;
private int b;
private ogg rif;
private Runnable r;
contieneth(ogg o){
rif = o;
r = new th();
}
public int getA(){
return a;
}
public int getB(){
return b;
}
public void setA(int a){
this.a = a;
}
public void setB(int b){
this.b = b;
}
public ogg getRif(){
return rif;
}
public void esegui(){
//Thread t = new Thread(r);
//t.start();
}
}
class th extends contieneth implements Runnable{
public void run(){
try{
System.out.println("passo da qui ciao");
super.setA(getRif().metodo1());
Thread.sleep(5000);
super.setB(getRif().metodo2());
System.out.println(super.getA() + super.getB());
}
catch (InterruptedException e){
System.out.println("Thread interrotto");
}
}
}
class ogg{
public int metodo1(){
System.out.println("metodo1");
return 5;
}
public int metodo2(){
System.out.println("metodo2");
return 2;
}
public void metodo3(){
System.out.println("metodo3");
}
}
class mainth{
public static void main(String args[]){
ogg o = new ogg();
contieneth ogg2 = new contieneth(o);
// ogg2.esegui();
}
}