Write the definition of a method named printPowerOfTwoStars that receives a non-negative integer n and prints a string consisting of “2 to the n” asterisks.

Write the definition of a method named printPowerOfTwoStars that receives a non-negative integer n and prints a string  consisting of “2 to the n” asterisks.

LANGUAGE: JAVA

CHALLENGE:

Write the definition of a method named printPowerOfTwoStars that receives a non-negative integer n and prints a string consisting of “2 to the n” asterisks. So, if the method received 4 it would print 2 to the 4 asterisks, that is, 16 asterisks:
****************
and if it received 0 it would print 2 to the 0 (i.e. 1) asterisks:
*
The method must not use a loop of any kind (for, while, do-while) to accomplish its job.

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days – Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level