I am trying to understand the below line of difference between java wait() and sleep() methods. I understand basic of what each does but confused with the below statement frequently.
wait is called on Object while sleep is called on Thread.
what is object in above statement with respect to below code, because even thread object t is created like a any other object in java.
public class MyRunnableThreadClass implements Runnable{
public void run(){
try{
Thread.sleep
}
catch(Exception e){}
}
public class ThreadDemo {
Thread t = new Thread ( new MyRunnableThreadClass());
}
Could you please help which is Object and thread in this cases