public static synchronized void main(String[] args) throws  
InterruptedException {
Thread f = new Thread();
f.start();
System.out.print("A");
f.wait(1000);
System.out.print("B");
}
Output of the Java program

Posted on by