subject

In a program, write a method that accepts two arguments: an array of integers and a number n. The method should print all of the numbers in the array that are greater than the number n (in the order that they appear in the array, each on their own line). In the same file, create a main method and call your function using the following data sets:
The array {1, 5, 10, 2, 4, -3, 6} and the number 3.
The array {10, 12, 15, 24} and the number 12.
My code:
public class LargerThanN
{
public static void print(int[] array, int n)
{
for(int i=0; i {
if (array[i]>n)
System. out. println(array[i]);
}
System. out. println();
}
public static void main(String[] args)
{
int[] array1 = {1,5,10,2,4,-3,6};
int num1=3;
print(array1,num1);
int[] array2 = {10, 12, 15, 24};
int num2 = 12;
print(array2, num2);
}
}
My programming lab does not want extra lines between the output. What am I doing wrong? How do I fix it?

Failed Test Run
The contents of your standard output is incorrect.
Attention: the difference between your stdout and the expected stdout is just a question of spacing.
Standard Output Hide Invisibles
Your Code's Actual Result:
Expected Result: 5
5 10
10 4
4 6
6
15 15
24 24

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 08:00
Match the items with their respective descriptions.
Answers: 1
question
Computers and Technology, 23.06.2019 20:00
How much current flows through the alternator brushes? a. 2–5 a b. 25–35 a, depending on the vehicle c. 5–10 a d. 10–15 a
Answers: 2
question
Computers and Technology, 24.06.2019 02:30
Which option completes the explanation for conflict of interest in an organization
Answers: 1
question
Computers and Technology, 24.06.2019 13:00
Refer to the figure and match the theorem that supports the statement.1.if chords are =, then arcs are =.if bc = de, then arc bc = arc de2.if arcs are =, then chords are =.if arc bc = arc de, then bc = de3.diameters perpen
Answers: 3
You know the right answer?
In a program, write a method that accepts two arguments: an array of integers and a number n. The me...
Questions
question
History, 23.04.2021 17:10
question
Social Studies, 23.04.2021 17:10
question
Mathematics, 23.04.2021 17:10
question
Social Studies, 23.04.2021 17:10
question
Mathematics, 23.04.2021 17:10
Questions on the website: 13722367