fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. interface Numbers{
  9. public int process(int x,int y);
  10. }
  11. class Sum implements Numbers{
  12. public int process(int x,int y){
  13. return(x+y);
  14. }
  15. }
  16. class Average implements Numbers{
  17. public int process(int x,int y){
  18. return((x+y)/2);
  19. }
  20. }
  21. class Ideone{
  22. // your code goes here
  23. public static void main(String[] args){
  24. Sum a=new Sum();
  25. int sum=a.process(3,4);
  26. System.out.println(sum);
  27. Average b=new Average();
  28. int avg=b.process(3,4);
  29. System.out.println(avg);
  30. }
  31. }
Success #stdin #stdout 0.09s 2184192KB
stdin
Standard input is empty
stdout
7
3