https://www.codecademy.com/courses/learn-java/projects/java-prime-directive
I’m doing a Prime directive project and am stuck on a bug that I am confused about.
I made the code…
import java.util.ArrayList;
class PrimeDirective {
public static void main(String args) {
PrimeDirective pd = new PrimeDirective();
int[] numbers = {6, 29, 28, 33, 11, 100, 101, 43, 89};
public boolean isPrime(int number) {
for (int i = 2; i < number; i++){
if (number % i == 0) {
return false;
}
if(number == 2) {
return true;
} else if (number < 2){
return false;
System.out.println(pd.isPrime(6));
}
}
}
}
}
}
And when I put java PrimeDirective in the terminal so I can get an output nothing comes out. So then I put javac PrimeDirective.java to see the mistake I made, I get this
PrimeDirective.java:10: error: illegal start of
expression
public boolean isPrime(int number) {
^
PrimeDirective.java:24: error: class, interface
, or enum expected
}
^
2 errors
I’m confused about how I made an illegal start. How do I fix the mistake and make the starting not illegal? Also on how I made an interface, but an interface on what?