0_0_39656812_16420\Main.java:1: 错误: 类PrimeExpressionChecker是公共的, 应在名为 PrimeExpressionChecker.java 的文件中声明
public class PrimeExpressionChecker { public static boolean isPrime(int num) { if (num < 2) { return false; } for (int i = 2; i * i <= num; i++) { if (num % i == 0) { return false; } } return true; } public static void checkExpression(int x, int y) { boolean allPrime = true; for (int n = x; n <= y; n++) { int expressionValue = n * n + n + 41; if (!isPrime(expressionValue)) { allPrime = false; break; } } if (allPrime) { System.out.println("OK"); } else { System.out.println("Sorry"); } } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (true) { int x = scanner.nextInt(); int y = scanner.nextInt(); if (x == 0 && y == 0) { break; } checkExpression(x, y); } }}
^
0_0_39656812_16420\Main.java:1: 错误: 找不到符号
public class PrimeExpressionChecker { public static boolean isPrime(int num) { if (num < 2) { return false; } for (int i = 2; i * i <= num; i++) { if (num % i == 0) { return false; } } return true; } public static void checkExpression(int x, int y) { boolean allPrime = true; for (int n = x; n <= y; n++) { int expressionValue = n * n + n + 41; if (!isPrime(expressionValue)) { allPrime = false; break; } } if (allPrime) { System.out.println("OK"); } else { System.out.println("Sorry"); } } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (true) { int x = scanner.nextInt(); int y = scanner.nextInt(); if (x == 0 && y == 0) { break; } checkExpression(x, y); } }}
^
符号: 类 Scanner
位置: 类 PrimeExpressionChecker
0_0_39656812_16420\Main.java:1: 错误: 找不到符号
public class PrimeExpressionChecker { public static boolean isPrime(int num) { if (num < 2) { return false; } for (int i = 2; i * i <= num; i++) { if (num % i == 0) { return false; } } return true; } public static void checkExpression(int x, int y) { boolean allPrime = true; for (int n = x; n <= y; n++) { int expressionValue = n * n + n + 41; if (!isPrime(expressionValue)) { allPrime = false; break; } } if (allPrime) { System.out.println("OK"); } else { System.out.println("Sorry"); } } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (true) { int x = scanner.nextInt(); int y = scanner.nextInt(); if (x == 0 && y == 0) { break; } checkExpression(x, y); } }}
^
符号: 类 Scanner
位置: 类 PrimeExpressionChecker
3 个错误
|