Question: Consider the following two recursive methods: Version #1: public static void TwoNBlankLines(int n) { if (n > 0) { System.out.println(); TwoNBlankLines (n-1); System.out.println(); }
Consider the following two recursive methods: Version #1: public static void TwoNBlankLines(int n) { if (n > 0) { System.out.println(); TwoNBlankLines (n-1); System.out.println(); } } Version #2: public static void TwoNBlankLines (int n) { if (n > 0) { } } TwoNBlankLines (n-1); System.out.println(); System.out.println(); O For a given value of n, Version #1 outputs more blank lines than Version #2 O For a given value of n, Version #2 outputs more blank lines than Version #1 For a given value of n, both output the same number of blank lines O Both are incorrect because neither has a basis case O none of the above
Step by Step Solution
There are 3 Steps involved in it
The image contains two versions of a recursive method named TwoNBlankLines in Java which presumably ... View full answer
Get step-by-step solutions from verified subject matter experts
