Comments In Java

In Java, we have two types of comments. We use comments to write some text within our code. Compiler will ignore these comments.

Syntax:

Note: Comments in between the code gives more readability

Do you want to show auto generated code whenever you create a new class as shown below.

Follow the below steps:

I assume, you are using Eclipse IDE.

1. In eclipse, Go to Window – Preferences
2. From the left panel, Select Java – Code style – Code template
3. Under ‘Configure generated code and comments’, Expand Comments – Select Files and Click Edit and Enter your text and Click OK.

Whenever you create a new class, you can see comments.

Sample Program:

Must Read: Java Tutorial

Rajkumar SM is a founder of SoftwareTestingMaterial. He is a certified Software Test Engineer by profession and blogger & youtuber by choice. He has an extensive experience in the field of Software Testing. He writes here about Software Testing which includes both Manual and Automation Testing. He loves to be with his wife and cute little kid 'Freedom'.

Leave a Comment

Share via
Copy link
Powered by Social Snap