- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the difference between /* */ and /** */ comments in Java?
Multiline comments (/* */) are used to comment multiple lines in the source code.
Example
public class CommentsExample { /* Following is the main method here, We create a variable named num. And, print its value * */ public static void main(String args[]) { //Declaring a variable named num int num = 1; //Printing the value of the variable num System.out.println("value if the variable num: "+num); } }
Output
value if the variable num: 1
Documentation comments (/** */) are used to generate a documentation on the source code using the Javadoc tool.
Example
/** * @author Tutorialspoint */ public class CommentsExample { public static void main(String args[]) { int num = 1; System.out.println("value if the variable num: "+num); } }
Output
value if the variable num: 1
You can generate Java documentation of the above class using the Javadoc command as −
C:\Sample>javadoc CommentsExample.java
- Related Articles
- What is the difference between comments /*...*/ and /**...*/ in JavaScript?
- What is the difference between single-line and multi-line comments in JavaScript?
- What is the difference between Java and Core Java?
- What is the difference between Java and Java EE
- What is the difference between >> and >>> operators in Java?
- What is the difference between Java and JavaScript?
- What is the difference between compositions and aggregations in Java?
- What is the difference between abstraction and encapsulation in Java?
- What is the difference between transient and volatile in Java?
- What is the difference between Serialization and Deserialization in Java?
- What is the difference between System.out.println() and System.out.print() in Java?
- What is the difference between PATH and CLASSPATH in Java?
- What is the difference between ArrayList and LinkedList in Java?
- What is the difference between equals and compareTo in Java?
- What is the difference between StringBuffer and StringBuilder in java?

Advertisements