Write a recursive method to print all the permutations of a string. For instance, for a string abc, the printout is: abc acb bac bca cab cba. Use the following two methods, the second one being a helper method;public static void displayPermutations(String string);private static void displayPermutations(String prefix, String string);The first method simply invokes displayPermutations("", string). The second method uses a loop to move a character from string to prefix and recursively invoke it with the new prefix and string. The base case is when string is empty, and prints prefix to the console.;Your program should compile and run without errors.
Paper#67190 | Written in 18-Jul-2015Price : $27