Why doesn’t a private method go into the documentation in Java?

Asked

Viewed 111 times

1

Why when a method has one void as modifier it does not appear in the documentation?

As soon as I put the public it appeared in the documentation. Is there any other modifier that interferes with this?

  • 1

    Just for the sake of pedantry, void is not modifier in the usual sense of the word. It is much more intrinsically linked to the return of the method. Usually it says modifier: whether it is class or instance, or access modifier public/protected/private/package protected

  • Did any of the answers solve your question? Do you think you can accept one of them? Check out the [tour] how to do this, if you haven’t already. You would help the community by identifying what was the best solution for you. You can accept only one of them. But you can vote on any question or answer you find useful on the entire site.

2 answers

4

void will not change anything, is just an indicator that the method does not generate a result.

What is private is implementation detail, is something that can be changed at any time without notice. You can’t call what’s private, so not because you know how it works, you don’t have to document it.

Private members can be documented with the option -private.

4

The default documentation generator is the option -protected, that is, only classes, methods and fields public and protected will be documented. If you want documentation of all classes, methods and fields, use the option -private. As already answered by Maniero, this has nothing to do with the void.

Documentation on the documentation generator: javadoc

  • then what really makes the difference when documenting is yes the modifier

Browser other questions tagged

You are not signed in. Login or sign up in order to post.