Page 1 of 1

About Question enthuware.ocajp.i.v7.2.1252 :

Posted: Fri Jan 03, 2014 12:21 pm
by joao.pedro.ferreira
public class ChangeTest {
int d=0;
char[ ] cA = { 'a' , 'b'};


public void m1(){
m2(d, cA);
System.out.println( d + ", " + cA[1] );
}
public void m2(int c, char[ ] cA2){
//
c = 2;
cA2[1] = cA2[0] = 'm';
}
public static void main(String args[]){
new ChangeTest().m1();
}

}

//Output 0, m

why the value of "d" not change?

Re: About Question enthuware.ocajp.i.v7.2.1252 :

Posted: Fri Jan 03, 2014 9:27 pm
by admin
Why do you think it should change?

Re: About Question enthuware.ocajp.i.v7.2.1252 :

Posted: Fri Apr 11, 2014 8:59 am
by kwetal
There is a typo in the question's code. In the answers 3, 4 and 5 a space is clearly visible before the comma

Code: Select all

0 , m
b , b
b , m
while in the code, there is not:

Code: Select all

System.out.println( ( (int)c)  + ", " + cA[1] );

Re: About Question enthuware.ocajp.i.v7.2.1252 :

Posted: Fri Apr 11, 2014 9:19 am
by admin
Fixed.
thank you for your feedback!