In this code if I put in new String (ch) in the function call does the code work properly but if I put in str2 which is just converting the ch array back to string and when I input it in function call it does not work (commented part in code)
It gives an infinite loop of addresses. Why ?
Why new String works but not String created separately
Hey @code_breaker-1001 If you try to do ch.toString();(if. ch lets take example = a b) it will be a string = [a,b]
That is you are passing “[a,b]” to the StrPermuts function and since this is invalid string you are getting Infinite iterations.
That is why you can’t use ch.toString. If you still didn’t understand just print System.out.println(ch.toString()); You will get what I am saying.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.