Question: Java recursion- output Assume the availability of a method named makeStars that can be passed a non-negative integer n and that returns a String of
Java
recursion- output
Assume the availability of a method named makeStars that can be passed a non-negative integer n and that returns a String of nasterisks. Write a method named printTriangle that receives a non-negative integer n and prints a triangle of asterisks as follows: first a line of n asterisks, followed by a line of n-1 asterisks, and then a line of n-2 asterisks, and so on. For example, if the method received 5 it would print: * * * * * * * * * * * * * * *
The method must not use a loop of any kind (for, while, do-while) to accomplish its job. The method should invoke makeStars to accomplish the task of printing a single line.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
