In this article we will going to learn about the Java Keywords.
Here, we will discuss what is Java keywords and list of Java keywords.
What is Java keywords?
Keyword is one of the five tokens in the Java programming language. Token are the smallest individual unit in a program of Java programming language. Java keywords are the reserved word with special meanings that are conveyed to the Java compiler. As we know, keywords are the words with special purpose and they can't be used as the identifiers in the Java programming language. In Java programming language, there are total number of 51 keywords but in Java we uses only 49 keywords.
List of Java Keywords
Now here we will discuss all the keywords of Java programming language
S.No | Keyword | Description |
---|---|---|
1. | assert | Used for debugging. |
2. | break | Used for switching statement or break the loop. |
3. | case | Used to mark blocks of text in switch statement. |
4. |
char | Used to hold unsighted 16-bit unicode characters. |
5. | continue | To continues the loop. |
6. | do | To create a do-while statement it is used together with while. |
7. | else | To indicate conditional statements |
8. | extends | To indicate a class that is derived from another class. |
9. | finally | Used to show a block of code that will always be executed. |
10. | for | Used to create a for loop. |
11. | implements | Used to implements an interface. |
12. | instanceof | Indicates whether an object implements an interface or an instance of a specified class. |
13. |
interface | To declare a special class which includes abstract methods only. |
14. | native | Use to specify that a method which is implemented in native language. |
15. | null | It is used when a reference does not refer to anything. |
16. | private | It is an access modifier that indicates a method which can only be accessed within the declared class. |
17. | public | It is also an access modifier that indicates a method which can be accessed throughout the application. |
18. | short | Used to declare a variable which can hold 16-bit integer. |
19. |
strictfp | Used to restrict floating-point calculations and precision in order to ensure portability. |
20. | switch | Selects a block code to execute based on test value. |
21. | this | To refer the present object in a method. |
22. | throws | Refers to an exception that may be thrown by a method. |
23. | try | Starts a block code to test for an exception. |
24. | volatile | Shows that a variable can be change asynchronously. |
25. | abstract | It indicates an abstract class. |
26. | boolean | It is used to declare a Boolean type variable which hold only True and False value. |
27. | byte | Indicates a data type that can hold a 8-bit data value. |
28. | catch | Used to check exception created by try statements. |
29. | class | Indicates a new class. |
30. |
default | Indicates a default block of code in a switch statement. |
31. | double | Indicates a data type that can hold a 64-bit floating-point value. |
32. | enum | Indicates a defined fixed set of constant. |
33. | final | Indicates a variable that can hold a constant value. |
34. | float | Indicates a data type that can hold a 32-bit floating point value. |
35. | if | Used for testing conditions. |
36. |
import | Indicates a reference to other classes. |
37. |
int | Indicates a data type that can hold a sighted 32-bit integer. |
38. | long | Indicates a data type that can hold a 64-bit integer. |
39. | new | Used to create new objects. |
40. |
package | Indicates a Java package. |
41. | protected | It is also an access modifier that indicates a method which can be accessed from both inside and outside of the package but only through inheritance. |
42. |
return | Used to return a value from executed method. |
43. | static | To indicate a method or variable as class method. |
44. | super | Indicates the base class of a class. |
45. | synchronized | To specify critical methods or sections in a multi-threaded code. |
46. | throw | Used to throw an exception. |
47. | transient | With the use of transient keyword a data member will not be serialised. |
48. | void | Indicates a value that does not have a return value. |
49. | while | Creates a while loop. |
Note: The , and are not keywords they are literals but they are reserved words and can't be used as identifier. and are reserved words but are not currently supported by the Java.
Conclusion
Above we have discussed about the Java keywords. In this article, we have learnt what is Java keywords and list of Java keywords. Java keywords are the reserved word with special meanings that are conveyed to the Java compiler. In Java programming language, there are total number of 51 keywords but in Java we uses only 49 keywords.