Core JAVA

Write Once, Run Anywhere

  • Java Basic
Java - Overview
Java - Environmental Setup
First Step towards Java Programming
Importing Classes
Java - Basic Datatypes
Java - Variable Types
Java - Modifier types
Java - Basic Operators
Java - Loop Control
Java - Decision Making
Java - Numbers
Java - Characters
Java - Strings
Java - Arrays
Java - Date & Time
Java - Regular Expressions
Java - Methods
Java - Files and I/O
Java - Exceptions
  • Java Object Oriented
Java - Inheritance
Java - Overriding
Java - Polymorphism
Java - Abstraction
Java - Encapsulation
Java - Interfaces
Java - Packages
  • Java Advanced
Java - Data Structures
Java - Collections
Java - Serialization
Java - Networking
Java - Multithreading
Java - Applet Basics


      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:

  • Single line comments : These comments are for marking a single line as a comment. These comments start with double slash symbol // and after this, whatever is written till the end of the line is taken as a comment. For example,




  • Multi line comments : These comments are used for representing several lines as comments. These comments start with */. In between /* and */, whatever is written is treated as a comment. For example,



  • Java documentation comments : These comments start with /** and end with */. These comments are used to provide description for every feature in a Java program. This description proves helpful in the creation of a .html file called API(Application Programming Interface) document. Java documentation comments should be used before every feature in the program as shown here:



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 :


Powered by Blog - Widget
Face Upward - Widget