هذا البرنامج
import java.lang.*;
import javax.swing.JOptionPane;
class The extends Thread {
private String whoami;
private int delay;
public The(String b, int d) {
whoami =b;
delay=d;
}
public void run() {
try {
sleep (delay);
}catch (InterruptedException e) {}
System.out.println ("Hi! " + whoami + " " + delay);
}
}
public class Aa {
public static void main (String args[]) {
The t1, t2, t3;
t1=new The ("Thread1", (int)(Math.random() * 10));
t2=new The ("Thread2", (int)(Math.random() * 10));
t3=new The ("Thread3", (int) (Math.random() * 10));
t1.start();
t2.start();
t3.start();
String result;
if (t1==t2 && t1==t3)
result = "you win a car!!";
else
result = "please try again";
JOptionPane.showMessageDialog( null, result );
}
}
هو شغال لكن t1=t2=t3 مايرجع لي الجواب "you win a car" ويرجع جواب "please try again"
والسوال الثاني شلون ادخل الجرافكس على البرنامج ويظهر لي ناتج t1 t2 t3 داخل label?
