1

When I compile the following code it shows this error: main(java.lang.String) already declared in main(String args[])

public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] array1 = new int[10];
    for (int i = 0; i < array1.length; i++)
        if (sc.hasNextInt())
            array1[i] = sc.nextInt();
    sc.close();
    int[] array2 = new int[10];
    for (int i = 0; i < array2.length; i++)
        if (sc.hasNextInt())
            array2[i] = sc.nextInt();
    median(array1, array2);
    sc.close();
}
4

1 に答える 1