Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
    Bookmark Topic Watch Topic
  • New Topic

ans is 4 but how ? (Method invocation)

 
Talal Shaikh
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Report post to moderator
public class example {
int a[] = {0};
public static void main (String args[]){
int i[] = {1};
change_i(i);
System.out.println(i[0]);
}
public static void change_i(int i[]) {
i[0] = 2;
i[0] *= 2;
}
}
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
  • Report post to moderator
I've tried answering you in this thread.
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please don't post the same question in multiple forums. You can continue the discussion in the Java In General Forum (see link in Anthony's post)
 
    Bookmark Topic Watch Topic
  • New Topic