pro43.java

interface numbers { int process(int x,int y); } class sum implements numbers { public int process(int x,int y) { return(x+y); } } class avg implements numbers { public int process(int x,int y) { return((x+y)/2); } } class pro43 { public static void main(String...args) { int n_sum,n_avg; sum ob1=new sum(); avg ob2=new avg(); n_sum=ob1.process(5,5); n_avg=ob2.process(9,9); System.out.println("number for addition are 5 and 5 "); System.out.println("sum of two number is =="+n_sum); System.out.println("number for avg are 9 and 9 "); System.out.println("avg of two number is =="+n_avg); } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.