import java.io.*; class A { void display()throws InterruptedException { System.out.println("black"); } } class B extends A { void display()throws InterruptedException { Thread.sleep(1000); System.out.println("white"); } public static void main(String[] args) { A a=new B(); try { a.display(); } catch(InterruptedException e) {} } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter