There is no method on Thread instances that corresponds to "sleep(long)".
Thread.currentThread().sleep(2000); does compile, however, because there is a method on the thread class that is called sleep() with a long argument.
Java allows this as a compiler time trick so that new coders could execute this when they are confused about the static access of methods.
However, what this actually is resolved to in the compiler is:
Thread.sleep(2000);
The following code is also equivalent:
Thread t = new Thread(new Runnable() { public void run() { // do nothing } });
t.sleep(2000);
As one poster (John V) has pointed out, this doesn't make the actual thread (t) instance sleep - the current thread that created the thread object is put to sleep.
The warning exists such that you remember that you're accessing a static method of a class, not a method of an instance variable.
The appropriate code to write is always Thread.sleep(2000); - never access static methods through an instance to avoid confusion and this warning.