title: Are arrays passed by value or passed by reference in Java?
body: <p>Arrays are not a <a href="http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html" rel="noreferrer">primitive type</a> in Java, but they <a href="https://stackoverflow.com/questions/5564423/arrays-in-java-and-how-they-are-stored-in-memory">are not objects either</a>, so are they passed by value or by reference? Does it depend on what the array contains, for example references or a primitive type?</p>