What is the correct answer? | Selenium Forum
K
Kartic Saha Posted on 14/07/2019

Q.12What is output of following?


public class Test {
int i;
int j;
public static void main(String[] args) {
Test t1 = new Test();
t1.i=200;
t1.j=100;
add(t1);
System.out.print(t1.i);
System.out.print(t1.j);
}

public static void add(Test t) {
t.i=t.i+100;
t.j=t.j+100;
System.out.print(t.i);
System.out.print(t.j);

}

}

 
Here correct answer 1)
but where I ran got the output: 300200300200

A
Ashish Thakur Replied on 17/07/2019

Thanks for your report, we're looking into this and will resolve the issue soon.