Write a method writeNums that takes an
integer n as a parameter and that writes the first n integers starting with
1 to System.out in sequential order and separated by commas. All output
should be on the current line of output.
For example, the following calls:
writeNums(5);
System.out.println(); // to complete the line of output
writeNums(12);
System.out.println(); // to complete the line of output
should produce the output:
1, 2, 3, 4, 5
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
You must exactly reproduce the format of the examples above. Your method
should throw an IllegalArgumentException if passed a value less than 1.
You may NOT use a while loop, for loop or do/while loop to solve this
problem; you must use recursion.
Write your solution to writeNums below.