Page 381 - Computer science 868 Class 12
P. 381
20 char temp;
21 char[] charArray = a.toCharArray();
22 temp = charArray[i] ;
23 charArray[i] = charArray[j];
24 charArray[j] = temp;
25 return String.valueOf(charArray);
26 }
27
28 public static void main()
29 {
30 Scanner sc= new Scanner(System.in);
31 String str;
32 int l;
33 System.out.println("Enter a word");
34 str = sc.next();
35 l = str.length();
36 combination comb = new combination();
37 comb.change(str, 0, l-1);
38 }
39 }
The output of the preceding program is as follows:
Enter a word
SUN
SUN
SNU
USN
UNS
NUS
NSU
379
Strings 379

