Reply
Sat 5 May, 2012 01:57 pm
public class Test1 implements Runnable {
// private Test1 task; // toimii myös ilman attribuutin määrittämistä
public static void main(String[] args) {
Test1 test1 = new Test1(); // luodaan konstruktorin avulla olio test1
}
public Test1() {
// luo säikeen ja käynnistää sen. Mihin tuo this viittaa?
// se viittaa oletus
new Thread(this).start();
}
public void run() {
System.out.println("test ");
}
}
question: where "this" refers to if there are not attributes defined in the class Test1?