Answer:
public static void printString(String x, int y){
//Create a for loop
//How does a for loop work?
//It collects a starting point, an end point and an increment respectively....all these are passed in as arguments into the for loop
//For example, the code below starts from 0, lets say we set y=5, the loop runs from zero to 5... i.e
//Note: i++ in the loop is the increment, it means the loop increases by 1
for(int i=0; i<y; i++){
//As the loop increases, your String is printed
//So... the number of strings printed is directly proportional to the number of times your loop runs
System.out.print(x);
}
}
Step-by-step explanation:
Create a for loop
How does a for loop work?
It collects a starting point, an end point and an increment respectively....all these are passed in as arguments into the for loop
For example, the code below starts from 0, lets say we set y=5, the loop runs from zero to 5... i.e
Note: i++ in the loop is the increment, it means the loop increases by 1
As the loop increases, your String is printed
So... the number of strings printed is directly proportional to the number of times your loop runs