Project

General

Profile

Java's switch statement eval / not supports null-value

Added by Komorek, Kamil almost 5 years ago

So basic:

Object honey = null

switch (honey) {    // NPE !
  case whatever:
    // ...

  default:
    // ... Wont evaluate
}

Solution
Put if (honey == null) before switch.


Comments