Keywords in Java
Well, keywords are such words, which have some special meaning, and are used for some special purpose. These are not used anywhere else, other than where they are meant to be. For example, let’s consider the example of a doctor. Well, we have a cardiologist(related to the heart), a dentist(related to teeth and gums), an ophthalmologist(related to eyes), etc.
Well, when we say dentist, we mean a doctor who treats problems related to teeth and gums. So, a dentist can be a keyword when we want to mention a doctor who treats problems related to teeth and gums. So, the dentist word is supposed to be used here only, and nowhere else.
Similarly, in our life as well, we use many such words, which are supposed to be used at certain places and nowhere else. Like if we say sleep, this means that we are going to sleep.
Similar to this, we have some keywords in java, which are supposed to be used at certain points in the programs, and nowhere else. Here are some keywords, and many of them are going to be used in many of our programs.
- Abstract
- boolean
- break
- byte
- char
- case
- catch
- class
- continue
- do
- double
- else
- extends
- final
- float
- for
- if
- import
- long
- new
- private
- public
- protected
- return
- switch
- while
- void
- and many more…
The above keywords are just some keywords to mention. However, there are some other keywords as well, which will be encountered and understood when we will require to use them. You can also explore much about the keywords in java. Just all you need to understand is that keyword is some word whose meaning is already understood, and we cannot use it anywhere else in the programs other than what they are used for.
For example, when we are going to create a float-type variable, we are going to make use of the float keyword. Since the meaning of the float keyword is already understood, it will be accordingly done, but we cannot use float as the name of the variable, because it has some different meaning. You can try doing this and you will find that we are unable to do that.