The computer programs use comments to embed information in its source code. Different programming languages have their own set of rules defined in the program’s specification. Not only this, the syntax for writing comments varies from one programming language to the other. Most of the programming languages ignore comments when their compiler debugs a programming language.
Java uses comments to document the computer program. The comments also act as a reference point for other programmers of things the code contains. The comments in any programming language help programmers in debugging a code. Not only this, they can also be used by a large program for documentation purposes. Comments help in integrating the source in with source code management systems and other kinds of external programming tools.
On the other hand, a program with awkward comments can even lead to errors in a code that can be difficult to debug. Also, a comment with improper syntax, can lead the debugger using it as a normal programming code. Many times a lot of unwanted information is also stored as comments.
An example of a comment is given below:
max = 1000; // This is the default value.
/* check input for valid values and print error message for if problems exist. */
This program code uses two different types of comments, namely the end-of-line comments and the block comments. An end-of-line comment terminates at the end of the line where it is specified. The block comment on the other hand can continue for several lines or end in one single line depending on its terminator.
Programmers have been using comments for a long time now. Programs such as BASIC and COBOL use remarks, which are nothing but comments. Similarly, the language ALGOL 60 uses the
Continue reading Java Comments
Java Comments
The computer programs use comments to embed information in its source code. Different programming languages have their own set of rules defined in the program’s specification. Not only this, the syntax for writing comments varies from one programming language to the other. Most of the programming languages ignore comments when their compiler debugs a programming language.
Java uses comments to document the computer program. The comments also act as a reference point for other programmers of things the code contains. The comments in any programming language help programmers in debugging a code. Not only this, they can also be used by a large program for documentation purposes. Comments help in integrating the source in with source code management systems and other kinds of external programming tools.
On the other hand, a program with awkward comments can even lead to errors in a code that can be difficult to debug. Also, a comment with improper syntax, can lead the debugger using it as a normal programming code. Many times a lot of unwanted information is also stored as comments.
An example of a comment is given below:
max = 1000; // This is the default value.
/* check input for valid values and print error message for if problems exist. */
This program code uses two different types of comments, namely the end-of-line comments and the block comments. An end-of-line comment terminates at the end of the line where it is specified. The block comment on the other hand can continue for several lines or end in one single line depending on its terminator.
Programmers have been using comments for a long time now. Programs such as BASIC and COBOL use remarks, which are nothing but comments. Similarly, the language ALGOL 60 uses the
Continue reading Java Comments
Category: Java Basics | Leave a comment