For this Question: Given the first 2 terms A and B of an Arithmetic Series, tell the Nth term of the series.<b>User Task:</b>
Since this will be a functional problem, you don't have to take input. You just have to complete the function <b>NthAP()</b> that takes the integer A, B, and N as a parameter.

<b>Constraints:</b>
-10<sup>3</sup> &le; A &le; 10<sup>3</sup>
-10<sup>3</sup> &le; B &le; 10<sup>3</sup>
1 &le; N &le; 10<sup>4</sup>Return the Nth term of  AP series.Sample Input 1:
2 3 4

Sample Output 1:
5

Sample Input 2:
1 2 10

Sample output 2:
10, I have written this Solution Code: class Solution {
  public static int NthAP(int a, int b, int n){
        return a+(n-1)*(b-a);
    }
}

, In this Programming Language: Java, Now tell me if this Code is compilable or not?