gpt4 book ai didi

java - 输出整数数组

转载 作者:行者123 更新时间:2023-11-29 05:48:37 25 4
gpt4 key购买 nike

<分区>

public class Set {
private int[] num;

public Set(int ... nums){
this.num = nums;
}
public int getSet(){

for (int results : this.num){
return results;
}
}

}

我写了这个类作为测试来查看尝试并使用方法输出整数数组,但我遇到了麻烦

驱动程序如下:

public class SetTest {
public static void main(String[] args) {

Set set = new Set();

set.Set(1,2,3);

set.getSet();

}
}

我不知道该怎么做,我也收到这个错误“方法 IntegerSet(int, int, int) 对于类型 Set 是未定义的”

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com