Skip to main content

Reserved words

Reserved Words:
                                   In java, some words are reserved to represent some meaning or functionality such types of words are called reserved words.




  • Data type related keywords:
                    1. byte
                    2. short
                    3. int
                    5. long
                    6. float
                    7. double
                    8. char

  • Flow control-related keywords:
                    1. if
                    2. else
                    3. switch
                    4. case
                    5. default
                    6. do
                    7. while
                    8. for
                    9. continue
                    10. return
                    11. break

  • Modifiers related keywords:
                    1. public
                    2. private
                    3. protected
                    4. static
                    5. final
                    6. abstract
                    7. synchronized
                    8. native
                    9. strictfp
                    10. volatile
                    11.transitive

  • Exception related keywords:
                    1. try
                    2. catch
                    3. finally
                    4. throw
                    5. throws
                    6. assert

  • class-related keywords:
                    1. class
                    2. interface
                    3. extends
                    4. implements
                    5. package
                    6. import

  • object-related keywords:
                    1. new
                    2. instanceof
                    3. super
                    4. this

  • return type keyword:
                    1. void

                    goto and const are unused keywords. If we use it, we will get a compile-time error.

  • enum keyword ( included from 1.5 version):
                    We can use an enum to define a group of named constant.


# Conclusion:
  1. All 53 reserved words in java contain only lowercase alphabets symbol.
  2. In java, we have the only new keyword and there is not delete keyword. Because destruction of useless objects is the responsibility of Garbage Collector.
  3. The following are the new keyword in java.
                    strictfp --------     1.2 version
                    assert   ----------  1.4 version
                    enum   ----------  1.5 version







Que :-  Which of the following are valid Java reserved words?
                    public        valid
                    static        valid
                    main        Invalid
                    String        invalid
                    void        valid
                    args        Invalid

Comments