public class ArithmeticSequence {\n\xa0 \xa0 public static int nthTerm(int a, int d, int n)\xa0{\n\xa0 \xa0 \xa0 \xa0 // \a\ is first term \xa0\n\xa0 \xa0 \xa0 \xa0 // \d\ is common difference \xa0\n\xa0 \xa0 \xa0 \xa0 // \n\ is the nth term\n\xa0 \xa0 \xa0 \xa0 int result = a + (n - 1) * d; \xa0\n\xa0 \xa0 \xa0 \xa0 return result; \n\xa0 \xa0 }\n\xa0 \xa0 public static void main(String[] args){ \xa0\n\xa0 \xa0 \xa0 \xa0 // Sample usage\n\xa0 \xa0 \xa0 \xa0 int a = 3;\n\xa0 \xa0 \xa0 \xa0 int d = 2;\n\xa0 \xa0 \xa0 \xa0 int n = 4;\n\xa0 \xa0 \xa0 \xa0 int nthTerm = nthTerm(a, d, n);\n\xa0 \xa0 \xa0 \xa0 System.out.println(n + "th term of the arithmetic sequence with first term "+a+" and common difference "+d+" is "+nthTerm);\n\xa0 \xa0 } \n}
Generate a correct java program to find the nth term of an arithmetic sequence.?