class Test implements Runnable { public void run() { try { while (true) { System.out.print(1); synchronized (this) { wait(); notify(); } } } catch (InterruptedException e) { e.printStackTrace(); } }}public class bk { public static void main(String[] args) { Test t = new Test(); new Thread(t).start(); }}