Avoid Null Pointer Exception In Java