interface customer { int a= 20; /* that is why its final because one value is assinged it becomes final*/ void purchase(); } class Raju implements customer { @Override public void purchase() { System.out.println("raj needs "+a+"kg"); } } class Check { public static void main(String[] args) { customer r= new Raju(); r.purchase(); } }
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