Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java - where to specify what a class does?

Tags:

java

I am currently working on a rather large java project, and I am having small problems remembering what everything does right away, and am often continuously looking through the classes contents in order to remember exactly what everything does. Is there any conventional way of declaring what each class / method? I am looking for something similar to python's method declarations:

def foo(x):
'''
Takes and integer x and adds 1
'''
return x + 1
like image 909
bob Avatar asked May 23 '26 17:05

bob


1 Answers

I strongly urge you to learn, practice and write Javadoc!

How to Write Doc Comments for the Javadoc Tool

You can write javadoc everywhere, because a javadoc is a comment. The javadoc tool (or your IDE - Netbeans for example) should give you insight when you hover (as appropriate). It's also used to generate the official API documentation. It is an example of "literate programming" and here is an official sample, namely File.

like image 67
Elliott Frisch Avatar answered May 26 '26 05:05

Elliott Frisch