我有一个任务,我必须在 Java 中对数组执行操作,我必须为每个操作创建单独的函数,我将编写这些函数,但我不知道如何使用数组参数调用方法。我通常用 c++ 编程,但这个作业是用 java 编写的。如果你们中的任何人可以帮助我,我将非常感激。:)
public class HelloJava {
static void inpoot() {
Scanner input = new Scanner(System.in);
int[] numbers = new int[10];
System.out.println("Please enter 10 numbers ");
for (int i = 0; i < numbers.length; i++) {
numbers[i] = input.nextInt();
}
}
static void outpoot(int[] numbers) {
for(int i = 0; i < numbers.length; i++) {
System.out.println(numbers[i]);
}
}
public static void main(String[] args) {
inpoot();
outpoot(numbers); //can not find the symbol
}
}