I am learning Java on OS X through terminal. When I compile the code below I do not get any errors but When I try to run it I get
Exception in thread "main" java.lang.NoSuchMethodError: main
My code:
public class Problem5{
public void main(String[] args) {
int n = 1;
while(!checkMod(n)){
n++;
}
}
public boolean checkMod(int in)
{
int count = 0;
for(int i=1; i<20; i++)
{
if(in%i == 0)
{
count = count + 1;
}
}
if(count ==19)
{
return true;
}
else{
return false;
}
}
}
I removed "static" from the main method because I am calling the checkMod method.
How do I code this correctly?
Thanks