Answer:
import java.util.Scanner;
public class NewArray {
//Main Method begins here
public static void main(String[] args) {
int [] numbers = {30,20,50,2,-1,44,3,12,90,32}; //The given array
Scanner in = new Scanner(System.in);
System.out.println("enter a number");
int n = in.nextInt(); //Receive the number from the user
//Calling the method largerThanN
largerThanN(numbers, numbers.length,n);
}
//The method largerThanN begins here
public static void largerThanN(int []intArray, int arraySize, int n){
for(int i = 0; i < intArray.length; i++){
if(intArray[i] > n){
System.out.println(intArray[i]);
}
}
}
}
Explanation:
Uisng the Java prograamming language the solution is provided above.
Please see the comments within the code for detailed explanation
The key logic within the method largerThanN () is using a for loop to iterate the entire array. Within the for loop use an if statement to compare each element with the the number n entered by the user