Complete the code to check if a number is less than 2, which is not prime.
if (num [1] 2) { return false; }
Numbers less than 2 are not prime, so we check if num is less than 2.
Complete the for loop to check divisors from 2 up to the square root of the number.
for (int i = 2; i [1] Math.sqrt(num); i++) { if (num % i == 0) { return false; } }
We check divisors from 2 up to and including the square root of num.
Fix the error in the if condition that checks if num is divisible by i.
if (num [1] i == 0) { return false; }
The modulus operator '%' checks if num is divisible by i with no remainder.
Fill both blanks to complete the method signature and return type for checking prime.
public static [1] isPrime([2] num) { // method body }
The method returns true or false, so return type is boolean. The input number is an integer, so parameter type is int.
Fill in the blank to complete the return statement after the loop to indicate the number is prime.
return [1];
If no divisor is found, the number is prime, so return true.
