Skip to content

Tag: recursion

reverse a string using recursion with java

I am trying to write a recursion to reverse a String.This is my approach. I dont get why when it reaches the base case, where my a is already empty but I am still able to print out the reversed string. Answer you are not implementing any recursion, you just replaced two halves of a string.

How do I approach this recursively in Java?

In this program I need to get input from the user that indicates the length of the numbers with this quality: The number should be prime and if you delete each digit from the right the number that is left should still be prime. i.e. 2399 is such a number. Because 2399 is prime, and also 239, and 23, and