Hello World with Comments
This is a program that will tell us the use of comments in a code.
Learning Objectives
To learn java concepts related to :
- Multi-line comments
- Single line comments
Program Approach
To learn putting comments for the purpose of documentation. These comments enhance readability of the program but they are not executed nor they have any effect on the output of the program. For multi-line comments we shall use /*..*/ while for the single-line comments we will use//.
Source Code
|
|
Run Output
Code Understanding
/* A program to show the purpose of comments Author: ComputerSirKiClass */
This is a multi line comment. Whenever we give a multi line comment we use /* (front slash-asterisk) in the beginning and */(asterisk-front slash) in the end. Multi-line commenting tags are also helpful to comment anything within a program code.
System.out.println(βHello Worldβ);//Method for output to console
Use of double front slash(front solidus) makes it a single line comment. Anything after double slash is ignored. // can not be used for inline commenting within the code.
Suggested Filename(s): HelloWorldC.java
Created: 16-Aug-2016 10:46 | Updated: 16-Jun-2026 18:51|
