# Java Program to Check Whether a Number is an Even or Odd Hello Shouters !! Today we will make a Java Program to Check Whether a Number is an Even or Odd.

## What is an Even Or Odd Number?

The number is said to be even if the number is completely divisible by the number 2 which means after division it gives a remainder of 0. An odd number is a number that leaves remainder 1 after division with 2.

## 1. First Method- Division Method

In this method, we will divide the number by 2 and check if the remainder is 1 or not. Depending on the value we will check the number.

Output – Enter the Number you want to check 24 Even Number

## 2. Second Method- Using Bitwise Operator

In this method, we will Bitwise And (&) the number with 1 and we will get one only if the number is odd.

Example- The binary code of 9 is 1001 and the binary code of 1 is 1000 we will get 1000 as the output which makes 1 in decimal number.

Output – Enter the Number you want to check 23 Odd Number

So, it is very important to understand the Java Program to Check Whether a number is odd or even.

We daily add Multiple Choice Questions for placement preparation questions and technical interview preparation on the Instagram page. Check the Instagram account: https://www.instagram.com/shoutcoders/

What is an even or odd number?

In mathematics, a number is said to be even if the number is completely divisible by the number 2 which means after division giving a remainder of 0. An odd number is a number that leaves remainder 1 after division with 2.

How can we Check an odd or even number in Java?

There are various methods for checking, the most used method is the division method.

How can we Check an odd or even number with logical operators?

Using Bitwise And operator, we can Check an odd or even number.

Is 0 an even number?

Yes, 0 is an even number because it satisfies all the conditions of an even number.

Is the Even/Odd program important for placement preparations?

Yes, it is asked in many big companies like Microsoft, Amazon and many other product-based companies.

## Recommended Posts –

#### You may have missed 