Java Comments

Java 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:

  1. 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

Specialist Master (Architect) with a passion for cutting-edge technologies like AEM (Adobe Experience Manager) and a proven track record of delivering high-quality software solutions.

  • Languages: Java, Python
  • Frameworks: J2EE, Spring, Struts 2.0, Hibernate
  • Web Technologies: React, HTML, CSS
  • Analytics: Adobe Analytics
  • Tools & Technologies: IntelliJ, JIRA

🌐 LinkedIn

📝 Blogs

📧 Imran Khan