Reputation: 3
Visual Example of what I wish to accomplish.
When creating a method in the java language on the Eclipse IDE, How do you make it so you get the information(yellow) about your method(white)?
Sometimes I forget the exact meaning of my methods and it would be nice to keep my comments.
(This should go without needing to be said but I am wanting the descriptions when I call my mehtods in other files.)
More info::
FileA.java{
classA{
classA(){}
//Generic comment
MethodA(){}
}
}
FileB.java{
MehtodB(){
classA a = new classA();
a.mehtodA(); ----->I should see //Generic comment when typing in this
}
}
Upvotes: 0
Views: 37
Reputation: 2098
Hopefully I got your question right. I think what you need is the 'documentation comment' which is a type of comment that you add right above your method. For example:
/**
* The add() method returns addition of given numbers.
*/
public static int add(int a, int b){
return a+b;
}
When you are navigating this method, you'll be prompted with the comment.
Upvotes: 0
Reputation: 102822
That's called 'javadoc'. It looks like so:
/**
* This is javadoc.
* Note the double star start.
*
* You can {@code place some} tags in here for formatting.
*
* @param name User's full name, in title case, as they prefer to be called.
* @throws IllegalArgumentException If name is blank
*/
public void setName(String name) {
...
}
'javadoc tutorial' is a good thing to search the web for, presumably :)
Note that javadoc is not stored in class files; it is stored separately. If you use e.g. maven to distribute dependencies you can ship a separate jar with the javadoc included, the javadoc
tool can make HTML for you (but eclipse and co don't need this). Generally, you either link the javadoc (maven does this for you, otherwise, right click a dependency and you can associate a source jar or javadoc jar), or if it's source files, eclipse just figures it out.
Upvotes: 1