1. Home
  2. Java
  3. Java Examples
  4. Check Even-Odd Number

Check Even-Odd Number

Java – Check Even or Odd Number

Write a Java program to check if a number of even or odd. What is an Even or Odd number?

  • Even Number are not completely divisible by 2 (Eg: 1,3,5)
  • Odd Number are number completely divisible by 2 (Eg: 2,4,5)

Use the below example to check a number is Even of Odd.

Compile and run this program:

javac EvenOddTest.java
java EvenOddTest

Output

Odd Number