Core JAVAWrite Once, Run Anywhere |
Whenever we want to write a program, we should first think about writing comments. What are comments? Comments are the description about the features of a program. This means that whatever we write in a program should be described using comments. Why should we write comments? we can understand what the program is doing as well as it helps others to easily follow our code. This means readability and understandability of a program will be more. If a program is understandable, then only it can be usable in a software. So writing comments is compulsory in any program. Remember, it is a good programming habit.
There are three types of comments in Java-single line, multi line, and Java documentation. Let us discuss all of them:
Starting a Java Program :
Before we start writing our first Java program, let us see how how a Java program looks like. Please observe the following code:
Output :