/* (non-javadoc) meaning

Mian Asbat Ahmad picture Mian Asbat Ahmad · Mar 2, 2011 · Viewed 30.7k times · Source

Possible Duplicate:
Does “/* (non-javadoc)” have a well-understood meaning?

What does the following statements mean?

    /* (non-Javadoc)
     * 
     * Standard class loader method to load a class and resolve it.
     * 
     * @see java.lang.ClassLoader#loadClass(java.lang.String)
     */
    @SuppressWarnings("unchecked")

Answer

DwB picture DwB · Mar 2, 2011

Javadoc looks for comments that start with /**. By tradition, method comments that are not intended to be part of the java docs start with "/* (non-Javadoc)" (at least when your dev environment is Eclipse).

As an aside, avoid using multi-line comments inside methods. For example, avoid this:

public void iterateEdges()
{
  int i = 0;

  /* 
   * Repeat once for every side of the polygon.
   */
  while (i < 4)
  {
  } 
}

The following is preferred:

public void iterateEdges()
{
  int i = 0;

  // Repeat once for every side of the polygon.
  while (i < 4)
  {
    ++i;
  } 
}

The reason is that you open the possibility to comment out the entire method:

/*
public void iterateEdges()
{
  int i = 0;

  // Repeat once for every side of the polygon.
  while (i < 4)
  {
     ++i;
  } 
}
*/

public void iterateEdges()
{
  // For each square edge.
  for (int index = 0; index < 4; ++index)
  {
  }
}

Now you can still see the old method's behaviour while implementing the new method. This is also useful when debugging (to simplify the code).