5 Replies - 2800 Views - Last Post: 30 December 2010 - 06:45 AM Rate Topic: ***-- 1 Votes

#1 mittu.thefire  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 25-December 10

difference between comment types

Posted 29 December 2010 - 07:25 AM

We know that java supports 3 types of comments
i know about single line comment and multiple line comments..
i didn't understand the difference between multiple line & documentation comments

please help me soon
Is This A Good Question/Topic? 0
  • +

Replies To: difference between comment types

#2 Paars  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 39
  • Joined: 11-October 10

Re: difference between comment types

Posted 29 December 2010 - 07:36 AM

This?
http://docstore.mik....nut/ch07_03.htm
Was This Post Helpful? 0
  • +
  • -

#3 mittu.thefire  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 25-December 10

Re: difference between comment types

Posted 29 December 2010 - 08:10 AM

View PostPaars, on 29 December 2010 - 06:36 AM, said:



Thanks for reply..

But please give me difference in a simple way..
I can't understand that..
Was This Post Helpful? 0
  • +
  • -

#4 Paars  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 39
  • Joined: 11-October 10

Re: difference between comment types

Posted 29 December 2010 - 08:16 AM

// 1 line comment

/*
Multiple 
Lines 
Comment
*/

// @author mittu the fire 
// would add additional information when creating a javadoc for example 



Was This Post Helpful? 0
  • +
  • -

#5 cfoley  Icon User is offline

  • Cabbage
  • member icon

Reputation: 1907
  • View blog
  • Posts: 3,953
  • Joined: 11-December 07

Re: difference between comment types

Posted 29 December 2010 - 08:48 AM

Doc comments are used to create HTML pages which document your code. If you run the javadoc utility on one of your projects each HTML page will describe a class. However, all it can do is gather information from your code like the names of methods, what arguments they take and what the return type is.

Doc comments are your chance to add a programmer-friendly description. You can add whatever text you like and even spice it up with some HTML tags. A quick example is:

/**
 * Some text about factorials.
 * Some text about this method performing atrociously. 
 * Some text about it failing in n <= 0.
 */
public static factorial(int n) {
   if (n <=2) return 1;
   return factorial(n-1) + factorial(n-2);
}



As far as teh compiler is concerned, they are exactly the same as multi-line comments. The double star denotes them as javadoc comments and the star at the beginning of each line is just for prettiness, though it is convention.

It gets more involved with tags for each variable, return types and exceptions, etc. If you take a look at some of the Java API source code you'll get a good idea of how they are used and what you can do.
Was This Post Helpful? 0
  • +
  • -

#6 mittu.thefire  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 25-December 10

Re: difference between comment types

Posted 30 December 2010 - 06:45 AM

thanks friends
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1