Hello World with Comments – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Code Learning #JAVA#553 siteicon   siteicon   siteicon  

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

TC++ #553

Source Code

Run Output

Hello World!

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



Share

admin| Created: 16-Aug-2016 | Updated: 8-Dec-2017|






Back