java求助!!!

P1001 A+B Problem

blackying @ 2023-07-27 13:23:38

我用Java语言写的,用idea都能够运行,但是这里就编译失败了,为什么啊???!


by Sprague_Garundy @ 2023-07-27 13:28:26

你可以看一下示例代码。


by MrPython @ 2023-07-30 09:46:33

盲猜文件名不同导致主类错了

import java.io.*;
import java.util.*;
public class Main {
    public static void main(String args[]) throws Exception {
        Scanner cin=new Scanner(System.in);
        int a = cin.nextInt(), b = cin.nextInt();
        System.out.println(a+b);
    }
}

by xjhOI @ 2023-08-03 10:25:31

仔细看一下题下面例子中的类名以及格式


by whatfuck @ 2023-08-11 12:11:58

@blackying

import java.io.*;
import java.util.*;
public class Main {
    public static void main(String args[]) throws Exception {
        Scanner cin=new Scanner(System.in);
        int a = cin.nextInt(), b = cin.nextInt();
        System.out.println(a+b);
    }
}

有示范


|