字符串列表的排列


import java.util.Scanner;
import java.util.ArrayList;
public class PhotoLineups {
public static void allPermutations(ArrayList<String> permList, ArrayList<String> nameList) {    
if (nameList.isEmpty()) {
for (int i = 0; i < permList.size(); i++) {
if(i == permList.size()-1) {
System.out.print(permList.get(i));
}
else {
System.out.print(permList.get(i)+", ");
}
}
System.out.println();
} else {
for (int i = 0; i < nameList.size(); ++i) {
ArrayList<String> newPerm = new ArrayList<String>(permList);
newPerm.add(nameList.get(i));
ArrayList<String> newNameList = new ArrayList<String>(nameList);
newNameList.remove(i);
allPermutations(newPerm, newNameList);
}
}
}
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
ArrayList<String> nameList = new ArrayList<String>();
ArrayList<String> permList = new ArrayList<String>();
String name;
while (true) {
name = scnr.next();
if (name.equals("-1")) break;
nameList.add(name);
}
allPermutations(permList, nameList);
}
}

当我在zyBooks上运行它时,我得到这个1和唯一的错误:

Tests studentPhotos.printAllPermutations() correctly creates and outputs permutations
Compilation failed:
zyLabsUnitTest.java:27: error: cannot find symbol
studentPhotos.printAllPermutations(permList, nameList);
^
symbol:   method printAllPermutations(ArrayList<String>,ArrayList<String>)
location: variable studentPhotos of type PhotoLineups
1 error

谁能帮我解决这个问题?

好的,我现在正在编辑这个,因为你添加了那个评论。

从我看到你的错误,你试图调用方法printAllPermutations(ArrayList<String>, ArrayList<String>)时,该方法不存在。如果要我猜的话,我猜你在调用这个方法的时候不小心输入了printAllPermutations而不是allPermutations