Project

General

Profile

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

Added by Komorek, Kamil 26 days ago

So basic:

Object honey = null

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

  default:
    // ... Wont evaluate
}

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


Comments