Answer:
public class Main
{
public static void printString(String strText, int intNumber) {
for(int i=0; i<intNumber; i++){
System.out.println(strText);
}
}
public static void main(String[] args) {
printString("Brainly", 3);
}
}
Explanation:
- Define a function called <em>printString</em> that takes two parameters - a String and an int. Since the function will print out the given String, it's type will be <u>void</u>.
- Use <em>for loop</em> to iterate according to the given number and print the given string
- In the main, call the <em>printString </em>function with some parameters.
Answer: A
Explanation: For any formal document you need your major points.
Answer:
The correct output of this question is "Sneezy Sleepy".
Explanation:
In the given code firstly we create the object of the integer class that is first in this we pass the integer value that is 7. Then we declare another second integer variable is this variable we pass object as a reference. Then we use the two conditional statements. In the first, if block we check that the object of the class is equal to the reference variable. If it is true it prints Sneezy. otherwise, it will print Grumpy. In second if block we check that the object of the class is equal to the reference variable. but in this time we the equals() function it is the same as(==). If the condition is true it prints Sleepy. otherwise, it will print Doc. So the output of the code is Sneezy Sleepy.