Reserved words are also known as Java keywords Where reserved words cannot be used as variables, methods, classes, or any other identifiers:
SL.NO | Keyword | Description |
1. | abstract | An abstract keyword is used to declare as abstract class. Abstract class can provide the implementation of interface. It can have abstract and non-abstract methods. |
2. | boolean | Java boolean keyword is used to declare a variable as a boolean type. It can hold True and False values only. |
3. | break | break keyword are used in loop or switch statement. |
4. | case | case keyword are used in the switch statements to mark blocks of text. |
5. | catch | In Java catch keyword are used in an exceptions generated by try statements. It must be used after the try block only. |
6. | char | char keyword are used in data type that is used to store a single character. |
7. | class | class keyword are used for declare a class. |
8. | continue | It continues the current flow of the program and skips the remaining code at the specified condition. |
9. | default | default keyword are used to specify the default block of code in a switch statement. |
10 | do | do keyword are used in control statement to declare a loop. It can iterate a part of the program several times. |
11. | double | double keyword are used to declare a variable that can hold a 64-bit floating-point numbers. |
12. | else | else keyword are used to indicate the alternative branches in an if statement. |
13. | enum | enum keyword are used to define a fixed set of constants. Enum constructors are always private or default. |
14. | extends | extends keyword are used to indicate that a class is derived from another class or interface. |
15. | final | final keyword are used to indicate that a variable holds a constant value. It is applied with a variable. It is used to restrict the user. |
16. | finally | finally keyword indicates a block of code in a try-catch structure. This block is always executed whether exception is handled or not. |
17. | float | float keyword is used to declare a variable that can hold a 32-bit floating-point number. |
18. | for | for keyword are used to start a for loop. It is used to execute a set of instructions/functions repeatedly when some conditions become true. If the number of iteration is fixed, it is recommended to use for loop. |
19. | if | if keyword test the condition. It executes the if block if condition is true. |
20. | implements | implements keyword are used to implement an interface. |
21. | import | import keyword makes classes and interfaces available and accessible to the current source code. |
22. | instanceof | instanceof keyword is used to test whether the object is an instance of the specified class or implements an interface. |
23. | int | int keyword is used to declare a variable that can hold a 32-bit signed integer. |
24. | interface | interface keyword is used to declare an interface. It can have only abstract methods. |
25. | long | long keyword is used to declare a variable that can hold a 64-bit integer. |
26. | native | Specifies that a method is implemented with native (platform-specific) code |
27. | new | new keyword is used to create new objects. |
28. | null | null keyword are used to indicate that a reference does not refer to anything. It removes the garbage value. |
29. | package | package keyword are used to declare a Java package that includes the classes. |
30 | private | private keyword is an access modifier. It is used to indicate that a method or variable may be accessed only in the class in which it is declared. |
31. | protected | protected keyword is an access modifier. It can be accessible within package and outside the package but through inheritance only. It can't be applied on the class. |
32. | public | public keyword is an access modifier. It is used to indicate that an item is accessible anywhere. It has the widest scope among all other modifiers.
|
33. | return | return keyword is used to return from a method when its execution is complete. |
34. | short | short keyword is used to declare a variable that can hold a 16-bit integer. |
35. | static | static keyword is used to indicate that a variable or method is a class method. The static keyword in Java is used for memory management mainly. |
36. | super | super keyword is a reference variable that is used to refer parent class object. It can be used to invoke immediate parent class method. |
37. | switch | switch keyword contains a switch statement that executes code based on test value. The switch statement tests the equality of a variable against multiple values. |
38. | synchronized | synchronized keyword is used to specify the critical sections or methods in multithreaded code. |
39. | this | this keyword can be used to refer the current object in a method or constructor. |
40. | throw | Java throw keyword is used to explicitly throw an exception. The throw keyword is mainly used to throw custom exception. It is followed by an instance. |
41. | throws | Java throws keyword is used to declare an exception. Checked exception can be propagated with throws. |
42. | transient | transient keyword is used in serialization. If you define any data member as transient, it will not be serialized. |
43. | try | try keyword is used to start a block of code that will be tested for exceptions. The try block must be followed by either catch or finally block. |
44. | void | void keyword is used to specify that a method does not have a return value. |
45. | volatile | volatile keyword is used to indicate that a variable may change asynchronously. |
46. | while: | while keyword is used to start a while loop. This loop iterates a part of the program several times. If the number of iteration is not fixed, it is recommended to use while loop. |
47. | strictfp | strictfp is used to restrict the floating-point calculations to ensure portability. |