Java syntax: Difference between revisions

Content deleted Content added
No edit summary
m The revised statement spotlights the versatility of Java comments, now categorizing them into three distinct formats: traditional comments, end-of-line comments, and documentation comments. These types of comments play a pivotal role in enhancing code comprehension, facilitating effective developer communication, and are an integral aspect of Java programming.
Tag: Reverted
Line 228:
 
===Comments===
In Java, hascomments threeare kindsused to add explanatory notes or annotations within the code that are ignored by the compiler. Comments are primarily meant for developers to provide information, document code, and improve code readability. They serve as a form of communication within the codebase and can be used for various purposes.[https://blog.geekster.in/java-comments/ Java comments] include three types of comment formats: ''traditional comments'', ''end-of-line comments'' and ''documentation comments''.
 
Traditional comments, also known as blockSingle-line comments, start with <code>/*</code> and end with <code>*/</code>, they may span across multiple lines. This type of comment was derived from C and C++.
 
<syntaxhighlight lang="java">
Line 237:
</syntaxhighlight>
 
End-of-line comments, also known as Multi-line comments, start with <code>//</code> and extend to the end of the current line. This comment type is also present in C++ and in modern C.
<syntaxhighlight lang="java">
// This is an end-of-line comment