2

I want to print a char '=' repeatedly where I give the no. of times the asterisk should be repeated.

Example: count = 20 and I want to print ==================== using printf() and format specifiers.

2

1 Answer 1

4

String#repeat

Simply append a string generated by String#repeat method, in Java 11+.

String result = "=".repeat( 20 ) ;

====================

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.