Hey, getting a new error in my code... Its almost done, cant figure out what is wrong with this.
ERROR:
non-static method isPrime(int) cannot be referenced from a static context
import java.util.Scanner;
public class primenumbertest {
public boolean isPrime(int x){
int divisor = 1;
do{
divisor += 1;
} while ((x % divisor) !=0);
}
public static void main(String[] args) {
int num;
boolean isItPrimeorNot;
Scanner input = new Scanner(System.in);
System.out.println("Enter a number to find out if it's prime or not (greater than 1): ");
num = input.nextInt();
input.close();
isItPrimeorNot = isPrime(num);
System.out.println(isItPrimeorNot);
if (isItPrimeorNot == false) {
System.out.println(num + " is not a prime number.");
}
else {
System.out.println(num + "is a prime number.");
}
}
}