how i solve it without wait() of Thread
class A
{
static int total=0;
public void checkthis()
{
int i=1;
while(i<=10)
{
total+=100;
i++;
}
}
}
class Ani extends Thread
{
static A a;
public void run()
{
System.out.println(Thread.currentThread().getName());
synchronized(this)
{
a.checkthis();
a.total;
}
this.notify();
}
}
class Animals
{
public static void main(String[] args)throws InterruptedException
{
System.out.println(Thread.currentThread().getName());
Ani obj=new Ani();
// a=new A();
System.out.println("totalearning is "+obj.start();+" Rs");
synchronized(obj)
{
obj.wait();
}
}
}
--
-- You received this message because you are subscribed to the Google Groups
Code Jam group. To post to this group, send email to
[email protected]. To unsubscribe from this group, send email to
[email protected]. For more options, visit this group at
https://groups.google.com/d/forum/google-code?hl=en
---
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-code/5570a32b-6a21-4594-a329-557183ccb74an%40googlegroups.com.