class Chicks {
synchronized void yack(long id) {
for(int x = 1; x < 3; x++) {
System.out.println(id + " ");
Thread.yield();
}
}
}
public class ChicksYack implements Runnable {
Chicks c;
public static void main(
String args[]){
new ChicksYack().go();
}
void go() {
c = new Chicks();
new
Thread(new ChicksYack()).start();
new Thread(new ChicksYack()).start();
}
public void run() {
c.yack(Thread.currentThread().getId());
}
}
please tell me anyone the output of above code, and explain why.