I have a question about Java:
public class Tester {
private int[] testArray = {3, 4, 5};
public void increment(int n) {
n++;
}
public void firstTestMethod() {
for(int i = 0; i < testArray.length; i++) {
increment(testArray[i]);
System.out.print(testArray[i] + " ");
}
}
}
The output produced when invoking firstTestMethod
for a Tester
object is 3 4 5. Could someone please help explain why? Thank you!
Hi all,
Could anyone take a look at this other problem? The correct answer is C, but I just don't understand! The link to the picture is below.
Thanks in advance!