0
나는누구나 Java의 Combinations 클래스에 대한 import 문을 말할 수 있습니까?
import java.lang.org.apache.commons.math3.util.Combinations;
에 의해 조합을 가져올 시도했지만 내 소스 코드의 조합을 사용할 때이 오류가 계속.
import java.util.*;
import java.org.apache.commons.math3.util.Combinations;
public class PowerSet{ //gets power set for a set containing first n integers
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n = Integer.parseInt(args[0]);
for(int i=0; i<=n; i++){
Combinations c = new Combinations(n,i);
Iterator iter = c.iterator();
while(iter.hasNext()){
int[] iarr = (int[])iter.next();
System.out.print("{" + iarr[0]);
for(int a=1; a<iarr.length; a++){
System.out.println(", " + iarr[a]);
}
System.out.print("}, ");
}
}
}
}
오류가 분명히 나타나고 클래스가 존재하지 않는다고합니다. 계급이 잘못되었거나 계급을 수입해야하는 방식이 잘못 되었습니까? 당신이 당신의 import 문
java.lang.org.apache.commons.math3.util.Combinations;
에서 볼 수 있듯이
package java.org.apache.commons.math3.util does not exist
import java.org.apache.commons.math3.util.Combinations;
^
PowerSet.java:11: error: cannot find symbol
Combinations c = new Combinations(n,i);
^
symbol: class Combinations
location: class PowerSet
패키지를 프로젝트에 추가 했습니까 ('Combinations'는 Java 클래스가 아니고 Apache Project 라이브러리를 통해 추가되었습니다)? 어떤 IDE를 사용하고 있습니까? – AntonH
패키지 시작 부분에'java.'이 없어야합니다. IDE에 가져 오기를 남겨 두어야합니다. – bcsb1001
'java.lang' 비트를 버립니다. –