4 ms·
Because you don't always control where the code is being called from. Other compile time typed languages (C, C++, C#, typescript, rust, kotlin) usually would l
by ender341341 4y ago
Because you don't always control where the code is being called from.
Other compile time typed languages (C, C++, C#, typescript, rust, kotlin) usually would let you enforce that as part of the type system, but the java compiler will silently accept null in place of optional and throw an NPE at runtime.