logo CodeStepByStep logo

hashString

Language/Type: Java recursion
Related Links:

Write a recursive method named hashString that accepts an integer parameter k and returns a string of # (hash symbols) that is 2k characters long (i.e., 2 to the kth power). For example, the call of hashString(3) returns "########". Throw an IllegalArgumentException if k is less than 0. Do not use loops; you must use recursion.

Method: Write a Java method as described, not a complete program or class.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.