谁能帮一下我这个刚学Java的人?

P1001 A+B Problem

Entity909 @ 2021-11-07 14:06:40

刚学Java,编译器过了,洛谷每过。

import java.util.Scanner;
public class P1001 {
    int a,b;
    public void jf() {
        Scanner in=new Scanner(System.in);
        a=in.nextInt();
        b=in.nextInt();
        System.out.println(a+b);
    }
    public static void main(String[] args) {
        P1001 TheP1001=new P1001();
        TheP1001.jf();
    }
}

by WZKQWQ @ 2021-11-07 14:14:53

@Entity909 类应该取名Main的吧


by 昒昕 @ 2021-11-07 14:15:47

@Entity909 第二行的 P1001 要改为 Main


by XYY1411 @ 2021-11-07 14:16:44

洛谷要求主类名必须为 Main


by chubei_AC @ 2021-11-07 14:21:08

C党表示疑惑


by Entity909 @ 2021-11-07 14:26:24

@WZKQWQ Ok


by Entity909 @ 2021-11-07 14:26:45

@昒昕 Ok


by Entity909 @ 2021-11-07 14:27:04

@XYY1411 OK


by Entity909 @ 2021-11-07 14:27:42

@chubei_AC 对呀,我学c++的,也很疑惑。


|