Back To Java User Defined Methods Index
//program to create a function that takes two integer arguments calculates difference between them class diff { public void difftwo(int a,int b) { int dif; dif=a-b; System.out.println("difference between two numbers is " + dif); } } public class calcdifftwointegers { public static void main(String[] args) { diff ob=new diff(); ob.difftwo(10, 5); } }