# Prime Number Program in Java

### What is prime number Before check prime number in java program,we should clear what is prime number, a prime number is a number that can only divided by 1 or itself,for example,3,5,7,11,13,17… are prime nimbers,because all of them just can be divided by 1 or itself.

### Check prime number java program.

Always,the logic that check a number whether it is prime number logic or not, is to use the numbers from 2 to （the specific number)/2 to divide the specific number,if the remainder is not 0, than we can say the number is not a prime number.
As the below prime number program in java will show how to check a prime number,first let’s check a given number 5 if it’s prime number.

output

### Find prime number between to numbers in java program

Sometimes we need to find out the prime numbers between 2 given numbers, so we can use above checking prime number logic to write a checking prime number java program method,and call it to check all the numbers between the two given numbers,let’s go.

output