The number which is only divisible by itself and 1 is known as prime number, for example 7 is a prime number because it is only divisible by itself and 1.This method takes the number and then checks whether the given number is prime or not. The method then displays the result.