André Vale André Vale - 4 months ago 12
Java Question

C# Nullable<T> equivalent in Java

Is there a C#

Nullable<T>
equivalent in Java?

If not, how should I define a field in a class that is able to assume a
null
state?

Answer

Well any field of a reference type can be null. If you need something like a nullable int (int? in C#), then just use Integer (docs) in Java. Of course there are also types like that for double etc.