I doubt the answer is wrong for the followng question:
Given the following code what will be output?
public class Pass{
static int j=20;
public static void main(
String argv[]){
int i=10;
Pass p = new Pass();
p.amethod(i);
System.out.println(i);
System.out.println(j);
}
public void amethod(int x){
x=x*2;
j=j*2;
}
}
1) Error: amethod parameter does not match variable
2) 20 and 40
3) 10 and 40
4) 10, and 20
The answer is 3, but I chose the 4. Is there anything I am missing? Please advise. thx!
Mike