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, 22.06.2019 18:00
Determine whether the following careers would require training or college.
Answers: 1
question
Computers and Technology, 23.06.2019 00:20
The open systems interconnection (osi) reference model: defines standards for many aspects of computing and communications within a network. is a generic description for how computers use multiple layers of protocol rules to communicate across a network. defines standards for wireless local area network (wlan) communication protocols. details the advantages and disadvantages of various basic network cabling options.
Answers: 1
question
Computers and Technology, 24.06.2019 00:10
Read each statement below. if the statement describes a peer-to-peer network, put a p next to it. if the statement describes a server-based network, put an s next to it. p - peer-to-peer s - server-based
Answers: 1
question
Computers and Technology, 24.06.2019 00:30
Match the sentence fragment in the first column with the appropriate ending in the second column. a little per favore?
Answers: 1
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
Mathematics, 08.10.2020 05:01
question
Mathematics, 08.10.2020 05:01
question
Mathematics, 08.10.2020 05:01
question
Biology, 08.10.2020 05:01
question
Mathematics, 08.10.2020 05:01
question
Mathematics, 08.10.2020 05:01
Questions on the website: 13722362