我陷入了这个问题,并在终端中收到“Prime(int) 方法未定义为类型 Primeornot”的错误消息。 VScode 的问题选项卡中还显示了其他几个错误,为此我附上了它的屏幕截图。
我找不到其中的错误
import java.util.Scanner;
public static boolean isprime(int n) {
for(int i = 2; i<= Math.sqrt(a) ; i++ ){
if (n%i==0){
return false;
}
}
return true;
}
public class Primeornot {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
System.out.println(isprime(n));
}
}
• Iterable 类型未定义方法 stream()<EmployeeTwo>
• Integer 类型未定义方法 parseInt(String) [重复]
• 在 Generic 中检测并使用 Typescript 类型而不重复
• 为什么我得到“方法 uri(URI) 未定义对象类型”?
• Rails 嵌套表单为 nilClass 抛出未定义的方法
• 在带有类型错误的 Storybook 中寻求帮助:无法读取未定义的属性
• 错误:未为类“_DropdownMenuPainter”定义方法“clampDouble”
• moment-timezone 在 ember.js 中使用刺绣兼容性构建时返回未定义
• Vue-Cannot read properties of undefined (reading 'prototype')
• 索赔错误?对类型“TokenValidationParameters”的引用声称它是在“System.IdentityModel.Tokens.Jwt”中定义的