Check whether a given number is even or odd | Java program program to check for even or odd ; Returns true if n is even , else odd ; n & 1 is 1 , then odd , else even ; Driver code
class GFG { public static boolean isEven ( int n ) { if ( ( n & 1 ) == 0 ) return true ; else return false ; } return true ; else return false ; } public static void main ( String [ ] args ) { int n = 101 ; if ( isEven ( n ) == true ) System . out . print ( " Even " ) ; else System . out . print ( " Odd " ) ; } }