0 votes
1 view
in Java by (2.6k points)

I saw some method in java declared as:

void foo(@Nullable Object obj)

{ ... }

What's the meaning of @Nullable here? Does it mean the input could be null? Without the annotation, the input can still be null, so I guess that's not just it?

Thanks

1 Answer

0 votes
by (46.1k points)

This delivers it explicit that the method allows null values, and that if you reverse the method, you should also acquire null values.

It also assists as a reference for code analyzers like FindBugs. For instance, if such a program dereferences its argument without holding for null first, FindBugs will release a warning.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...