Which is faster, try catch or if-else in java (WRT performance)

Viewed 14094

Which one is faster:

Either this

try {
  n.foo();
} 
catch(NullPointerException ex) {
}

or

if (n != null) n.foo();
12 Answers
Related