
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Write Single Line Comment in Java
To comment a particular line just place ?double back slash (//)' before the line as shown below.
// Hello this line is commented
Example
Following example demonstrates the usage of single line comments in Java.
public class CommentsExample { 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
Advertisements