public class FoldPaper {
private ArrayList<String>res = new ArrayList<>();
public String[] foldPaper(int n) {
// write code here
printProcesses(1,n,true);
String []str= res.toArray(new String[]{});
return str;
}
问题:.toArray(new String[]{}) 小括号里面的参数是什么意思?
这个就是把容器里面的值转变为string数组
https://zhidao.baidu.com/question/581288767.html
本文介绍了一个Java示例程序,该程序展示了如何将ArrayList中的元素转换为String数组,并解释了 toArray(new String[]{}
116

被折叠的 条评论
为什么被折叠?



