Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
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 (46k 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.

Related questions

Browse Categories

...