Back To Java User Defined Methods Index
//program to create a function that takes two integer arguments and finds largest of them class largest { public void flarge(int a,int b) { if(a>b) { System.out.println(a + " is largest of two numbers"); } else { System.out.println(b + " is largest of two numbers"); } } } public class largesttwo { public static void main(String[] args) { largest ob=new largest(); ob.flarge(30,20); } }