The comment line explains the operation of the program to others.
There are 2 type of syntax for comment line.
syntax for single line comment:-
// comment line
syntax for multiline comments:-
/* comment line 1
comment line 2
comment line 3
.
.
comment line n */
The contents of a comment are ignored by compiler.
// is used for single line comment and /* is for multiline comments.
Example:-
/* Our 1st Java program
program to display welcome to aboutcodes */
class mypro {
// mypro is name of class
public static void main(String args[]){
// display welcome to aboutcodes
System.out.println("welcome to Aboutcodes");
}
}
Previous Code:-
Keyword used in java
List Code:-
Java codes
Next Code:-
User output
Java Programs:-
List of Java Programs
Keyword used in java
List Code:-
Java codes
Next Code:-
User output
Java Programs:-
List of Java Programs
Leave reply
Add your comments here