Hi,
I came across an interesting situation.
I've got a method that gets a class as a parameter so the caller method doesn't have to cast, because the called method will have the same return type as the class parameter's type. Here is a simplified version of that.
When I pass I get 10. When I pass "null" I still get 10. When I write I get a compiler error, of course.
My question: What happens when I pass null as a class and the JVM try to cast 10 to null in runtime?
I came across an interesting situation.
I've got a method that gets a class as a parameter so the caller method doesn't have to cast, because the called method will have the same return type as the class parameter's type. Here is a simplified version of that.
When I pass I get 10. When I pass "null" I still get 10. When I write I get a compiler error, of course.
My question: What happens when I pass null as a class and the JVM try to cast 10 to null in runtime?