I have a char array of A, B, C and I want to print the output as:
A,B,C,AB,AC,BC,ABC
Any suggestions will be appreciated…
public class CharArray {
public static void main(String[] args) {
char alpha[] = {'A', 'B', 'C'};
for(char s : alpha) {
//what to do now
}
}
}
This prints combinations, as in your example, not permutations, as in the title of the question.