For this Question: Write a JavaScript function with function name <code>first</code> to return the first n elements of an array. 
The function takes two arguments <code>array</code> and number <code> n </code>
Passing a parameter 'n' will return the first 'n' elements of the array.
The function will be tested as follows <code> first(array, n) </code>

Note to use Generate Expected Output section
Pass input like this 
<code>
5 4 2 1
1
</code>The function <code>first<code> accepts two arguments
- array which is an array like [1,2,3] 
- n which is a number like 2Return the array of first n numbers of array.const inputArray = [5,4,3,2,1]
const newArrayOfFirst2Numbers = first(inputArray,2)
console.log(newArrayOfFirst2Numbers) [5,4], I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
    public static void main (String[] args) {

           Scanner sc=new Scanner(System.in);
           String[] arr=sc.nextLine().split(" ");
           String n=sc.nextLine().trim();
           first(arr,n);
    }
    static void first(String arr[],String n)
    {
        for(int i=0;i<Integer.parseInt(n);i++)
        {
           System.out.println(Integer.parseInt(arr[i])) ;
        }
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?