29. What is the output of the following program?
public class TestArg {
int x = 100;
public static void main(String args[]) {
TestArg ta = new TestArg();
ta.method(ta);
}
void method(TestArg ta){
int x = 30;
System.out.println("The x value is " + ta.x);
method1(ta, x);
System.out.println("The x value is " + ta.x);
}
void method1(TestArg ta, int i ) {
ta.x += i;
}
}
[a] The x value is 100.
[b] The x value is 30.
[c] The x value is 130.
[d] The x value is 70.
Answer
[a] The x value is 100.
[c] The x value is 130. |