Example using Object lock synchronized blocks
It does look sound to me with one exception that you need to be aware of, as far as I can see:
if (!string.isEmpty()) {
    synchronized (lock) {
        lock.notify();
    }
    string = &quot;&quot;;
}

The moment you set string to a new value, the first thread might not have visited the variable at this point. You can see that when outputting string in both threads. This is only important if thread #1 is going to do processing on the value.
Additionally, because of the Thread.sleep(200); you might miss input lines because string value might have changed an unidentified number of times during this period.


I mean, if I don't add the 200ms delay in t2 execution, the thread will consume a lot of processing power, so, how can I create a listener behavior?

The same way you did between #2 and #1, notify #2 from #3.

To fix these issues, you want to use something like a BlockingQueue. Thread #3 pushes the line to the Queue, thread #2 dequeues the next value and notifies #1. Or, #2 pushes it to a second Queue for #1.