192k views
1 vote
Given the following method static void nPrint(String message, int n) { while (n > 0) { System.out.print(message); n--; } } What is the printout of the call nPrint('a', 4)?

User Vvahans
by
8.4k points

1 Answer

5 votes

Answer: aaaa

Explanation:

Since the condition of n > 0 is satisfied, the number will decreement and the print out will look like the above answer.

User Hasan Bayat
by
8.7k points