求助,为什么报错了呀

P1001 A+B Problem

2867254664wang @ 2021-04-16 11:40:39

        /tmp/compiler_72lm50sp/Main.java:5: 错误: 类Problem是公共的, 应在名为 Problem.java 的文件中声明

public class Problem { ^ 1 个错误

package chapter01;

import java.util.Scanner;

public class Problem {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int a = cin.nextInt();
        int b = cin.nextInt();
        System.out.println(a+b);
    }
}

by JRzyh @ 2021-04-16 11:52:13

洛谷中java的 public class 后都应该写 Main


|