Is it possible to exit the RUNNABLE state without executing a single command?

I am reading the Oracle SE 7 Certified Exams book for programmers 1Z0-804 and 1Z0-805 . One of the questions is asking for the output of this code.

class ThreadTest {
    public static void main(String []args) throws InterruptedException {
        Thread t1 = new Thread() {
            public void run() { System.out.print("t1 "); }
        };
        Thread t2 = new Thread() {
            public void run() { System.out.print("t2 "); }
        };
        t1.start();
        t1.sleep(5000);
        t2.start();
        t2.sleep(5000);
        System.out.println("main ");
    }
}

The book says that it will always output t1 t2 main, because TIMED_WAITING state can only reach from RUNNABLE .

But I thought that the thread could exit the RUNNABLE state without following any instructions.

Doc says:

A thread in runnable state is running in a Java virtual machine, but it can expect other resources from the operating system, such as a processor.

? RUNNABLE, ?

+4
1

, , .

, . RUNNABLE - , . (, , , BLOCKED) run() ( , TERMINATED). , -, .

- , ; public void run() {} : return. return, RUNNABLE TERMINATED.

(). " " 5 , . , - .

:

  • t1.
  • 5 . , 5 , , , . , .
  • t2. , t1 , , t2 ( ) .
  • 5 .
  • "main ". , , t1 t2.

, !

+5

All Articles