I just wrote my first program using methods (I am only on chapter 5). I am not sure where I would use javadocs other than the ones that I already have in my code. Can someone help me?

/**
* @author Brock Shelton
* Date: March 15, 2010
* purpose: Complete a program that asks the user to enter the length
* and width and then determine the area and display it to the screen.
**/

import javax.swing.JOptionPane; // imports the JOptionPane class

public class AreaRectangle
{   // start of the class

/**
 *
 * @param the args default argument for the main method
 *
 */ 
  	public static void main(String[] args)
	{ // begins main
		double length;    // The rectangle's length
		double width;    // The rectangle's width
		double area;      // The rectangle's area
		
		displayWelcome(); // calls the displayWelcome message
   
		// Get the rectangle's length from the user.
		length = getLength();
   
		// Get the rectangle's width from the user.
		width = getWidth();

		// Get the rectangle's area.
		area = getArea(length, width);

		// Display the rectangle data.
		displayData(length, width, area);
	}


	public static double getLength()
	{ // start of the getLength method
		String input; // declares input as a string
		double length = 0.0; // declares length as a double and sets it to 0
		final String ASK = "Whats the rectangle's length?"; // declares a constant to ask the user
		final String INVALID = " You have entered invalid length"; // declares a constant
		final String NUM_INVALID = " Length must be positive"; // declares a constant
		
		input = JOptionPane.showInputDialog(ASK); // asks the user for length
		try
		{ // begin try
			length = Double.parseDouble(input); // sets length to the input
		} // end try
		catch (Exception ex)  // exception handler 
		{
			JOptionPane.showMessageDialog(null, INVALID);
			System.exit(1); // exits if there is an error
		}
		
		if (length <= 0.0)
		{ // begins if statement
			JOptionPane.showMessageDialog(null, NUM_INVALID);
			System.exit(1); /// exits the program if a negative number is entered
		} // ends if statement
		
		return length;
	} // ends length
	
	public static double getWidth()
	{  // begins getWidth method
		String input; // declares input as a string
		double width = 0.0; // declares width as a double and sets it to 0
		final String ASK_2 = " What is the rectangle's width"; // constant to ask the user
		final String INVALID_2 = " You have entered invalid width"; // constant to hold invalid input
		final String NUM_INVALID = " The width must be positive"; // constant to hold invalid input
		
		input = JOptionPane.showInputDialog(ASK_2); // asks the user to enter width
		try
		{ // begins try
			width = Double.parseDouble(input); // turns input to a double
		} // ends try 
		
		catch (Exception ex)  // exception handler
		{ // begins catch
			JOptionPane.showMessageDialog(null, INVALID_2); // error message
			System.exit(1); // exits if the user enteres characters
		} // ends catch
		
		if (width <= 0.0)
		{ // begins if statement
			JOptionPane.showMessageDialog(null, NUM_INVALID); // error message
			System.exit(1); // exits if any negative number is entered
		} // ends if statement
		
		return width;
	}
	      
	public static double getArea(double length, double width)
	{ // begins getArea
		double area; // declares area as a double
 
		area = length * width; // formula for the area
 
		return area;
	} // ends getArea
	
	
	// OUTPUT SECTION
	
	public static void displayData(double length, double width, double area)
	{
		JOptionPane.showMessageDialog(null, String.format("Length of rectangle = %.2f\n" +
									 "Width of rectangle = %.2f\n" + 
									 "Area of rectangle = %.2f", length, width, area)); // displays the length, width, and area
	}
	
	public static void displayWelcome()
	{
	final String WELCOME = " Author: Brock Shelton \n"
								+ " Date: March 15, 2010 \n"
						+ " Purpose: finish a program that asks the user to input width and length \n"
						+  " and then determins the area of the rectangle."; // string holding welcome message
	
		JOptionPane.showMessageDialog(null, WELCOME); // displays welcome message
	}
	

}

Above your methods you should add standard Javadoc comments:

/**
* bodilyFunctionsMethod
* This method makes the program more gross and its purpose
* is to demonstrate bodily functions. This is the description.
* @param farts they make this method stink
* @param poop it makes this method gooey
*/

public void someMethod (String farts, String poop){
//some code here! Woo!
}

See this guide from Java Sun (now Oracle but whatever!) on how to use Javadoc comments.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.