What is k after invoking nPrintA message k in the following

What is k after invoking nPrint(\"A message\", k) in the following codes? int k = 3; nPrint(\"A message\", k); a. 0 b. 1 c. 2 d. 3 e. None of the above

Solution

Code : static void nPrint(String message, int n) { while (n > 0) { System.out.print(message); n--; } } int k = 3; nPrint(\"A message,k); The value of k after invoking nPrint(\"A message\", k)is 3. Option d is correct choice.
 What is k after invoking nPrint(\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site