Question: Questions 14 16 are based on the following code: public static void nPrint(String message, int n) { while (n > 0) { System.out.print(message); n--; }
Questions 14 16 are based on the following code:
public static void nPrint(String message, int n)
{
while (n > 0)
{
System.out.print(message);
n--;
}
}
Flag this Question
Question 145 pts
The above code is an example of:
| A variable declaration |
| A while loop |
| A class definition |
| A method definition |
Flag this Question
Question 155 pts
What is the printout of the call: nPrint("a", 4);
| aaaaa |
| aaaa |
| aaa |
| aa |
Flag this Question
Question 165 pts
What is the value of the identifier k after the following code fragment is evaluated?
int k = 2;
nPrint("A message", k+1);
| 0 |
| 1 |
| 2 |
| 3 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
