Java Comments
Comments make java code more human readable and help them to understand better.
Proper use of comment let developer know the code functionality. Comments always ignore by the compiler while compiling the code. Comment can also be given to code to not to run or execute.
Single line comment uses for short comment. Multiline comment uses for long comments.
There are two types of comment:
- Single line comment:
Single line comment can be give by using two forward slaches.
// This is any array
String[] countArr = {"one", "two", "three"};
2. Multiline comment:
Multiline comment can be start by /* and end by */
Whatever written in between the comment will completely ignore by the compile.
/* This is String type array It has three array elements */ String[] countArr = {"one", "two", "three"};
Example:
Below is the simple example to show single and multiline comment:
Imran Khan, Adobe Community Advisor, AEM certified developer and Java Geek, is an experienced AEM developer with over 11 years of expertise in designing and implementing robust web applications. He leverages Adobe Experience Manager, Analytics, and Target to create dynamic digital experiences. Imran possesses extensive expertise in J2EE, Sightly, Struts 2.0, Spring, Hibernate, JPA, React, HTML, jQuery, and JavaScript.