Habe ich Probleme, schreiben von Javadoc-Kommentare für die main-Methode @param

Ich bin sehr neu in Java und die Einnahme einen online-Kurs mit wenig feedback.

Ich denke, dass ich das Programm abgeschlossen okay, aber mein prof verlangt Kommentaren zu tun und ich habe keine Hinweise auf Sie. Meine größte Bereich scheint zu sein, die @param Kommentare. Ich habe versucht, indem Sie verschiedene Dinge in dort, aber nichts ist richtig. Kann mir jemand sagen was ich falsch mache? Geben Sie mir einen link für leicht zu Lesen info @param Kommentare.

Hier ist mein code:

/**
 * 
 */
package edu.westga.cs6311.rectangles;

import java.awt.Rectangle;

/**
 * The RectangleIntersection class creates two rectangles that overlap (making a third rectangle) with a fourth rectangle not overlapping.
 * @author Tanya Fairbanks
 * @version 9/8/2013
 */
public class RectangleIntersection {

    /**
     * The main method is where the rectangles are created.
     * @param   rectangle1  the original rectangle
     * @param   rectangle2  the overlapping rectangle
     * @param   rectangle3  the rectangle made from intersecting rectangle1 & rectangle2
     * @param   rectangle4  the rectangle made that does not intersect with rectangle3
     */
    public static void main(String[] args) {
        //make 2 overlapping rectangles 

        Rectangle rectangle1 = new Rectangle(3, 12, 5, 3);
        Rectangle rectangle2 = new Rectangle(5, 11, 6, 4);

        System.out.println(rectangle1);
        System.out.println(rectangle2);

        //intersection of rectangles 1 & 2 is rectangle3
        Rectangle rectangle3 = rectangle1.intersection(rectangle2);
        System.out.println(rectangle3);


        //figure the area of rectangle3
        double width = rectangle3.getWidth();
        double height = rectangle3.getHeight();
        double area = width * height;
        System.out.println("Expected area: 9.0 ");
        System.out.println("Calculated area: " + area);

        //create 4th rectangle that doesn't overlap 3rd

        Rectangle rectangle4 = new Rectangle(1, 15, 13, 12);
        System.out.println(rectangle4);

        //find intersection of 3rd and 4th rectangles
        Rectangle theIntersection = rectangle3.intersection(rectangle4);
        System.out.println(theIntersection);

        //print expected area and calculated area of theIntersection

        double width2 = theIntersection.getWidth();
        double height2 = theIntersection.getHeight();
        double area2 = width2 * height2;
        System.out.println("Expected area: 0.0");
        System.out.println("Calculated area: " + area2);



    }

}
  • Die @param Kommentare sollen übereinstimmen mit argument-Bezeichner. Das einzige argument id ist "args", so das ist, was Ihr @param Kommentar erklären sollte.
InformationsquelleAutor user2769212 | 2013-09-11
Schreibe einen Kommentar