java program tutorial to check prime number

Published: 15 June 2022
on channel: Learner's Nation
194
4

this java program tutorial uses command line argument to take input from user and convert string args into integer type using wrapper class integer cast method. then it uses a for loop to check that if the given number is divisible by any of the number between 2 to that number - 1 . if yes then it is not prime.
because the number is prime only if it is divisible by 1 and itself not any other number.