This seems a homework assignment, and it’s nice to you to achieve this little goals to correct programming learning. As we’re not here to make your homework, here you have few steps to guide you through:
- Define a
Scanner
to ask user’s input - Use
Scanner
to put user’s input into a variable -
Use this variable in a inverted for-loop (with
loopCounter--
)for (int loopCounter = userInputVariable; loopCounter > 0; loopCounter --)
-
To repeat the
*
use:- StringUtils
String repeated = StringUtils.repeat("*", loopCounter);
or -
for loop to repeat the char
for (int innerLoopCounter = 0; innerLoopCounter < loopCounter; innerLoopCounter ++)
- StringUtils
2
solved How can I make a specific Java output with *? [closed]