I know that Java passes objects by reference, so when an object is passed as an argument into a method, anything that is done locally to the argument inside the method is done to the actual object.
void main(){
String[] array1 = {"a","b","c"};
someMethod(array1);
print(array1.length);
}
void someMethod(String[] array){
/..code here../
array = null;
}
I would expect to get a null pointer exception when trying to print array1.length because my method set it to null. However this is not happening. Is there a reason for this?