为什么程序无法运行,点击RUN无反应

import java.util.Scanner;

public class sushu {
private boolean isPrime(int n){
int i=0;
while(true){
if(i==2)break;
for(int t=1;t<n;t++){
if(n%t==0){
i++;
}
}
}
return true;
}
public void main(String[] agrs){
System.out.println("To determine whether primes");
System.out.println("Please enter the number :");
Scanner in=new Scanner(System.in);
int n=in.nextInt();
if(isPrime(n)){
System.out.println("The number is primes");
}
}
}

import java.util.Scanner;

public class sushu {
private static boolean isPrime(int n) {
int i = 0;
while (true) {
if (i == 2)
break;
for (int t = 1; t < n; t++) {
if (n % t == 0) {
i++;
}
}
}
return true;
}

public static void main(String[] agrs) {
    System.out.println("To determine whether primes");
    System.out.println("Please enter the number :");
    Scanner in = new Scanner(System.in);
    int n = in.nextInt();
    if (isPrime(n)) {
        System.out.println("The number is primes");
    }
}

}

main函数有问题 static

如果我加上static之后,方法那也要加上static才行,有没有什么可以避免
那就麻烦点写定时器来运行

加上static也没有什么不好啊

不用static的话,你需要构建一个sushu的对象,然后使用它来调用你的isPrime方法。(注意以后类的名称首字母要大写啊)
比如:
sushu ss = new sushu();
int n = 10;
if(ss.isPrime(n)){
//输出当前值为素数
]

public static void main(String[] args){}

缺少关键字