1

I have two constructors for a class and am adding JavaDoc comments to both of them, however there are only minor differences between the two constructors, I am wondering if their is a way to use the same JavaDoc comments for both but then add changes to one.

Here is an example (simplified)

/**
 * Car constructor
 * @param name Name of car
 * @param make Make of car
 */
public Car(String name, String make) {
    this.name = name;
    this.make = make;
}

/**
 * Car constructor
 * @param make Make of car
 */
public Car(String make) {
    this.name = "EXAMPLE";
    this.make = make;
}

Can I use the same JavaDoc for both? Is their any viable way to do this, obviously with this example it is not an issue as their are only 2 fields, but when using classes with more objects manually writing all the JavaDoc is a time consuming exercise.

Tom Meeson
  • 37
  • 5

0 Answers0