How to create and use JLabel

In java, labels are components used to hold the texts. A Label will look like "Text engraved in the container(may be a frame or panel)".

In general what is meant by a Label?

A Label is a piece of a paper that provides information about the object to which it is affixed with. Similarly, here alsothe sole purpose of a label is to provide information about the object that cannot able to identify itself to the user.

Say, for an example, In java,On seeing a button we can able to tell what it is intended to do, like NEXT, CANCEL, but a text field , text area cannot be able to describe themselves. So, in these kind of situations labels helps us to identify them.

Creating a Label

In order to create a label,we need to create an object for the JLabel class by giving the text to be displayed as a label, like