abstract class animal { public abstract void sound(); } class dog extends animal { public void sound() { System.out.println("dog is barking"); } } class tiger extends animal { public void sound() { System.out.println("dog is tiger"); } } class S{ public static void main(String[] args){ dog r= new dog(); tiger k= new tiger(); r.sound(); k.sound(); } }
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