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

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
joao.pedro.ferreira
Posts: 3
Joined: Thu Jan 02, 2014 12:52 pm
Contact:

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

Post 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?

admin
Site Admin
Posts: 10389
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

Why do you think it should change?

kwetal
Posts: 5
Joined: Thu Apr 03, 2014 3:50 am
Contact:

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

Post 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] );

admin
Site Admin
Posts: 10389
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

Fixed.
thank you for your feedback!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest