3

Consider this code:

try {
    ....
} catch (MyException e){
    /*Can e be null here?*/
}

Given that null in Java is a typed null reference, is it ever possible that the catch block above will be entered with e as null?

xlm
  • 6,854
  • 14
  • 53
  • 55
P45 Imminent
  • 8,319
  • 4
  • 35
  • 78

1 Answers1

7

e will never be null. Even if null gets thrown somewhere for some reason, e will just be a NullPointerException.

JREN
  • 3,572
  • 3
  • 27
  • 45