Hello to all
first look this code
class Square1 implements Runnable{
int a;
public void run(){
a=10;
}
}
class Square2 implements Runnable{
Square1 ob=new Square1();
public void run(){
System.out.println("Square Of this number is = "+(ob.a*ob.a));
}
}
class SquareThread{
public static void main(String args[]){
Thread t1=new Thread(new Square1());
Thread t2=new Thread(new Square2());
t1.start();
try{
t1.join();
}catch(InterruptedException e){
e.getStackTrace();
}
t2.start();
}
}
i need to find the square but answer is 0 so tell me how to find the square