J
jupiter
Help, there's a bug in my thread. The stud keeps winning.
public static void main(String[] args) {
AFCCG championship = new AFCCG();
Thread stud = new Thread(championship);
Thread goober = new Thread(championship);//"Pass that Runnable;
pass that Runnable"
stud.setName("Tom");
goober.setName("Peyton");
stud.setPriority(Thread.MAX_PRIORITY);
goober.setPriority(Thread.MIN_PRIORITY);
stud.start();
goober.start();
}
synchronized void run() {
int studCount = 0;
int gooberCount = 0;
for(int i = 1; i <10; i++) {
throwTDPass();
if(currentThread.getName().equals("Tom")) { studCount++}
else {gooberCount--}
}
if(studCount > gooberCount) {
System.out.println("Cut that meat; cut that meat!");
}
}
public static void main(String[] args) {
AFCCG championship = new AFCCG();
Thread stud = new Thread(championship);
Thread goober = new Thread(championship);//"Pass that Runnable;
pass that Runnable"
stud.setName("Tom");
goober.setName("Peyton");
stud.setPriority(Thread.MAX_PRIORITY);
goober.setPriority(Thread.MIN_PRIORITY);
stud.start();
goober.start();
}
synchronized void run() {
int studCount = 0;
int gooberCount = 0;
for(int i = 1; i <10; i++) {
throwTDPass();
if(currentThread.getName().equals("Tom")) { studCount++}
else {gooberCount--}
}
if(studCount > gooberCount) {
System.out.println("Cut that meat; cut that meat!");
}
}