text: Win a copy of Barcodes with iOS this week in the iOS forum or Core Java for the Impatient in the Java 8 forum!
  Originally posted by Rex Rodriguez: It prints bArr[0] value as 1 but the value of a is printed as 0. It should increment the value of a too, right? Can someone explain? public class test { public static void main(String args[]) { int a=0; int b=0; int[] bArr=new int[1]; bArr[0]=b; inc1(a); inc2(bArr); System.out.println("a="+a+" b="+b+" bArr[0]="+bArr[0]); } public static void inc1(int x) {x++; } public static void inc2(int[] x) {x[0]++;} }
  Originally posted by Valentin Crettaz: mark, OBJECTS ARE NOT PASSED BY REFERENCE IN JAVA!!! A COPY OF the reference is passed. In Java everything is passed by value, primitive and references !!