Back To Java User Defined Methods Index
//program to create a function that checks whether a number is even or odd (number is passed to function as argument) class evenodd { public void checkeodd(int a) { if(a%2==0) { System.out.println("number is even"); } else { System.out.println("number is odd"); } } } public class checkevenodd { public static void main(String[] args) { evenodd ob=new evenodd(); ob.checkeodd(100); } }