Hi welcome to the Java session. Today we are going to see the list of keywords available in Java.
We already know that keywords are reserved words which are having special meaning to the Java language. Hence we are not allowed to use keywords to name a variable, method or class name etc. A total of 50 reserved words are there in Java.
The list of keywords are:
Apart from the above keywords true, false and null might look like keywords, but actually they are not keywords. Still these are not allowed to name a variable.
Do remember that main is not a keyword in Java. That means main can be used for naming a variable. Of course it's a bad programming practice!
All these keywords will be covered in our tutorial. Hope the today session is useful to you.
We already know that keywords are reserved words which are having special meaning to the Java language. Hence we are not allowed to use keywords to name a variable, method or class name etc. A total of 50 reserved words are there in Java.
The list of keywords are:
- abstract
- assert (This is added in JDK 1.4)
- boolean
- break
- byte
- case
- catch
- char
- class
- const (This is not used)
- continue
- default
- do
- double
- else
- enum (This is added in JDK 1.5)
- extends
- final
- finally
- float
- for
- goto (This is not used)
- if
- implements
- import
- instanceof
- int
- interface
- long
- native
- new
- package
- private
- protected
- public
- return
- short
- static
- strictfp (This is added in JDK 1.2)
- super
- switch
- synchronized
- this
- throw
- throws
- transient
- try
- void
- volatile
- while
Apart from the above keywords true, false and null might look like keywords, but actually they are not keywords. Still these are not allowed to name a variable.
Do remember that main is not a keyword in Java. That means main can be used for naming a variable. Of course it's a bad programming practice!
All these keywords will be covered in our tutorial. Hope the today session is useful to you.
No comments:
Post a Comment