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

Popular posts from this blog

Literals

Literals:                 Any constant value which can be assigned to the variable is called literal.     1 . Integer Literals:                                        For integral data types ( byte, short, int, long ), we can specify a literal value in the following base...                         a) Decimal literal (base 10):                                                     Allowed digits are 0 to 9.                               ...

Data Types

Data Types:                         In java, Every variable and every expression has some type. Each and every data type is clearly defined. Every assignment should be checked by the compiler for data compatibility.                              Because of the above reason, we can conclude, Java language is strongly typed programming language. Que :-  Is java pure object-oriented programming language? Ans :- Java is not considered as the pure object-oriented programming language, because several oop features are not satisfied by java (like operator overloading, Multiple inheritances, etc.).               Moreover, we are depending on primitive data types, which are non-objects. Except for boolean and char, remaining data types are considered as signed data types. Because we ca...

The first simple program in java

The first program in java