But your explanation about the code,does not clear the main
problem comes to my mind. so i simplify the code and i slip out the
codes nonsense not to discuss unrelated things. So my question is
simple,
1-Why is the method waitTest not waiting forever?..
2-Why is the method waitTest waiting forever if t.start() is
commented as it should be.
the real problem is question 1..in my opinion in both cases with
commented and without commented waitTest should wait forever.
Another point: Could you create a thread design that works in J2ME
MIDP1.0 or 2.0 profile that has a suspend method in it. currently
suspend is not included but you should able to build a thread class
that can suspend itself and resume itself. how can you do such a
thing without self notify&wake up .
class ThreadTest extends Thread {
public synchronized void waitTest(){
try{
wait();
System.out.println("waitTest has called..");
}catch(Exception ex){
ex.printStackTrace();
}
}
public void run(){
System.out.println("I'M DOING NOTHING& I'M NONSENSE :(");
}
}
public class Test{
public static void main(String arg[]){
ThreadTest t=new ThreadTest();
t.start(); // t.waitTest() never waits..
t.waitTest();
}
}