Question: What does the following program do? // Exercise ANS: : SomeClass.java public class SomeClass { public static String someMethod(int[] array2, int x) if (x <
What does the following program do?
// Exercise ANS: : SomeClass.java
public class SomeClass {
public static String someMethod(int[] array2, int x)
if (x < array2.length) {
return String.format(
"%s%d ", someMethod(array2, x + 1), array2[x]);
}
else {
return "";
}
}
public static void main(String[] args) {
int[] array = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
String results = someMethod(array, 0);
System.out.println(results);
}
}
Step by Step Solution
3.47 Rating (157 Votes )
There are 3 Steps involved in it
This code ... View full answer
Get step-by-step solutions from verified subject matter experts
