Why is my method not seeing null Object
I seem not to understand this.
public class NewClass {
public static void main(String[] args) {
Object obj = null;
myMethod(obj);
}
public static void myMethod(Object... objArr) {
if(objArr != null) {
System.out.println("I am not null");
}
}
}
To my surprise, I am not null is printed on the console. Why is myMethod
not seeing the passed obj parameter as null.
No comments:
Post a Comment