The example aims to check if the given number is even or odd in Java.
Source Code
package com.beginner.examples;
public class EvenOddExample {
public static void main(String[] args){
int a = 105;
//use modulus operator to check if the number is even or odd
if(a%2 == 0)
System.out.println(a + " is an even number.");
else
System.out.println(a + " is an odd number.");
}
}
Output:
105 is an odd number.